I'm sorry but this makes me cringe.
After I saw 'for i = 1, select("#", unpack(self.Events)) do' I had to write back!
Why not use the standard way of writing a table loop?
Code:
local events = {"A", "B", "C"}
for i = 1, #events do
self:RegisterEvent(events[i])
end
The select function is great when fetching a specific argument returned from a function that returns a list of arguments, and using "#" returns how many arguments were returned.
Code:
function Events()
return "A", "B", "C"
end
for k, v in ipairs({Events()}) do
self:RegisterEvent(v)
end
Also this one works, not ideal but works. You encapsulate the returned arguments in a table and it will return the same table as in the first example. You then iterate it directly using ipairs.
In any case I find this to be a much better approach than unpacking the table to then use select "#" on it to iterate just over the index.