[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Iterate over vararg
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 20 Dec 2018 09:33:38 -0200
> [...] (Is there a way to avoid that first upvalue?) [...]
Yes:
Any access to lua_upvalueindex(n), where n is greater than the number
of upvalues of the current function (but not greater than 256, which
is one plus the maximum number of upvalues in a closure), produces an
acceptable but invalid index.
https://www.lua.org/manual/5.3/manual.html#4.4
Plus:
For functions that can be called with acceptable indices, any
non-valid index is treated as if it contains a value of a virtual type
LUA_TNONE, [...]
https://www.lua.org/manual/5.3/manual.html#4.3
-- Roberto