Issues

Issue #101 invalid

can not use "arg" to read vararg parameter

Anonymous created an issue

Example:

function putInTable (...)

local valuesTable = {}
for i,v in ipairs(arg) do
table.insert(valuesTable,v)
end
return valuesTable

end

-> arg return the game's folder instead of the arguments (values passed) of the function

Comments (2)

  1. vrld

    You use deprecated Lua syntax (since Lua 5.1). The hidden parameter arg is not supported anymore. Use {...} to get the a table of the values instead:

    function putInTable (...)
        local valuesTable = {} for i,v in ipairs({...}) do
            table.insert(valuesTable,v)
        end 
        return valuesTable -- or just return {...}
    end
    
  2. Log in to comment