lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,
 
In the following code...
 
function Caller()
    local a = {23, 45}
    local b = {-1, -2}
    F(unpack(a), unpack(b))
end
 
...I would expect F to be called with 4 parameters.
 
However:
 
function F(p1, p2, p3, p4)
    log(p1)
    log(p2)
    log(p3)
    log(p4)
end
 
Caller()
 
...then logs:
 
23
-1
-2
(null)
 
Is there any way to use more than one unpack() in a single function call? I'm using Lua 5.1 with LuaJIT btw.
 
    Thanks,
 
            Hugo