I’d personally use a table in case I have to reference the object later and want to do it easily (plus it works with modules), plus I don’t have to worry about manually adding the argument to the select function, but it’s up to you.
If you’re looking for it from a performance standpoint though, indexing seems to generally be a bit faster than select from my tests:
local obj1 = 1
local obj2 = 2
local t = tick()
for i = 1,1000 do
local selected = select(math.random(1,2), obj1, obj2)
end
local ft = tick() - t
print('Finished 1000 selects in',string.format('%f', ft))
wait(3) -- just to be sure no memory is being used up for whatever reason
local obj = {1;2}
local t = tick()
for i = 1,1000 do
local selected = obj[math.random(1,#obj)]
end
local ft = tick() - t
print('Finished 1000 indexes in',string.format('%f', ft))