How's everyone going?!
So, the title says pretty much all.
Why does RegisterUnitEvent responds to all units if the unit parameter is set to nil?
I currently have the following code.
Lua Code:
if info.event then
for event, unit in pairs(info.event) do
if type(unit) == "table" then
object:RegisterUnitEvent(event, unit[1], unit[2]);
else
object:RegisterEvent(event);
end
end
object:SetScript("OnEvent", function(self, event, ...)
prototype[event](self, info, ...);
end);
end
This will make an object respond to all units if
unit[2] is nil.
Why...?
I could just make an extra if statement to check if
unit[2] exists, but before that I really want to know what's the difference between leaving the second unit parameter empty and assigning nil?