Lua doesn't take ... as args?

vendredi 16 octobre 2015

Apparently after some update, the ... in a lua function does not seem to be stored into the arg table anymore?

Example:

Code:

function add(a, b, ...)
        local sum = a + b
        for i,v in ipairs(arg) do
                sum = sum + v
        end
        print("Sum = " .. sum)
end

So add(1, 2, 3, 4, 5, 6, 7, 8, 9)Will result an error

Quote:

bad argument #1 to 'ipairs' (table expected, got nil)
Lua doesn't take ... as args?

0 commentaires:

Enregistrer un commentaire