Originally Posted by shalom69
looking at this code (code isn't important except the highlighted part)
Code:
if (msg == "INCOMBAT FLAGGED") then
if sender == UnitName("player") then
local clone, target
for clone, target in pairs(cloneTargetTable) do
if target == "NONE" or nil then
RaidNotice_AddMessage(RaidWarningFrame, clone .." HAS NO TARGET", ChatTypeInfo["RAID_WARNING"])
end
end
elseif not UnitAffectingCombat("player") then
RaidNotice_AddMessage(RaidWarningFrame, sender .." HAS ENTERED COMBAT", ChatTypeInfo["RAID_WARNING"])
end
end
is there a way to declare the variables one further level in?
for example I know you can do
Code:
local _,target = strsplit(" ", msg, 2)
and declare it right in the operation you're doing. just that quick question,
thanks
|
You don't need to declare those variables as local at all, because they are automatically defined as local to the scope of the loop when used in a "for" statement:
Code:
for k, v in pairs(t) do
-- k and v exist here
end
-- but not here
Code:
for i = 1, 10 do
-- i exists here
end
-- but not here