lua-users home
lua-l archive

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


Framework Studios: Hugo skrev:
[...]

Is there any way to use more than one unpack() in a single function call? I'm using Lua 5.1 with LuaJIT btw.

Nope, see: http://www.lua.org/manual/5.1/manual.html#2.5

Specifically this part:
"Both function calls and vararg expressions may result in multiple values. If the expression is used as a statement (see §2.4.6) (only possible for function calls), then its return list is adjusted to zero elements, thus discarding all returned values. If the expression is used inside another expression or in the middle of a list of expressions, then its result list is adjusted to one element, thus discarding all values except the first one. If the expression is used as the last element of a list of expressions, then no adjustment is made, unless the call is enclosed in parentheses."

The examples after this text are pretty descriptive as well.

//Andreas