Hi~ I need some helps as i couldn't understand c closures in lua reference manual. As follows:
2)
void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
...
The maximum value forn
is 255.
...
1)
Any access to
lua_upvalueindex(n)
, wheren
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.
Both 1) and 2) are descriptions in Lua reference manual. And I am puzzled:
Why can the argument n
of lua_upvalueindex
be 256 when the maximum number of upvalues is 255?
Could anybody help me?