bartbes wrote: ↑Tue Nov 21, 2017 11:09 am
The problem is that you can only have varargs as the last argument(s). So if you rewrite your function like this, it won't error:
function poly(color, ...)
local args = {...}
local edges = {}
if type(color) ~= "table" then
edges[1] = color
end
for i = 1, #args do
table.insert(edges, args[i])
end
end
local color = color or {255,255,255,255}
----
local color = color ~= nil and color or {255,255,255,255}
----
local color = type(color) ~= 'nil' and color or {255,255,255,255}
----
-- And the same 3 ways can be used with if-then-else, as well.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.