Originally Posted by
Kanegasi
Return ends a function. A function will only ever use one return line, however you can return a table, a concatenated string, or even multiple values separated by commas.
Alright, that makes a lot of sense. And yeah, I apologize for the formatting of my code. Normally I would space it out like your example, but I tend to compact it that way for use in WeakAuras because the window is so short and it lets me see more of what's going on.
So, would a correct example be:
Code:
function()
local unit = UnitFactionGroup("player")
local isAlly = "This unit is Alliance " --[[Again, save myself from writing this multiple times]]
if (unit == 'Alliance') then
if (UnitIsPVP("player") then
return isAlly.."and is flagged for PvP."
else
return isAlly.."and is not flagged for PvP
end
else
return "An error occured."
end
end