lua-users home
lua-l archive

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


>> Actually, it works well. I mean {...}/unpack() is fully reversible.
> 
> You're just lucky with your data
> 
> $ lua -e 'print(select("#", unpack{ 1, nil, 3 }))'
> 3
> 
> $ luajit2 -e 'print(select("#", unpack{ 1, nil, 3 }))'
> 1
> 

Well, I was talking about vanilla Lua. Anyway, the above difference is very weird because it doesn't allow to postpone the usage of varargs, for instance, in some coroutine create/resume loop where arguments could be anything generic. Fortunately, I rely on this behavior only within a testing framework which is run under plain Lua.

// Seny