When a-c work is called, their upvalues are found at certain pseudo-indices
3.4 C Closures
When a-c function is made, you are able to relate some prices with-it, therefore generating a C closing; these standards have been called upvalues and so are handy for the function each time it really is called (read lua_pushcclosure ).
These pseudo-indices are manufactured of the macro lua_upvalueindex . Initial worth connected with a function is at place lua_upvalueindex(1) , and so on. Any access to lua_upvalueindex(n) , where n is actually greater than the quantity of upvalues in the present purpose (however greater than 256), generates a satisfactory (but incorrect) index.
3.5 Registry
Lua supplies a registry, a pre-defined table which you can use by any C code to save whatever Lua worth it needs to shop. This desk is always located at pseudo-index LUA_REGISTRYINDEX . (mais…)