Search code examples
loopsparameterslua

Getting all the parameters except for the first one [Lua]


So, I was trying to get only the second, third, etc.. parameters of a table, but I couldn't manage to do it.

Here's my code:

tArgs = {...}

local command = tArgs[1]
table.remove(tArgs, 1)

local paramNum = 0
local params = ""
local iteration = 1

for _, file in ipairs(tArgs) do
    paramNum = paramNum + 1
    while iteration < paramNum do
        parms = params .. tArgs[iteration]
    end
end

Solution

  • Here is a simpler solution:

    params = table.concat(tArgs,"",2)