3 ms·
For anyone wondering about "C upvalues", which wasn't clear to me, there is some explanation here: http://www.lua.org/pil/27.3.3.html http://www.lua.org/pil/27
by watmough 15y ago
For anyone wondering about "C upvalues", which wasn't clear to me, there is some explanation here:
http://www.lua.org/pil/27.3.3.html http://www.lua.org/pil/27.3.3.html
Essentially, they are unbound variables that have to be reachable from the function by some mechanism, making it a closure.
Apologies if I've misunderstood anything here.
- zeen 15y agoYou got it. Quoting from the 5.2 manual: Because of the lexical scoping rules, local variables can be freely accessed by functions defined inside their scope. A local variable used by an inner function is called an upvalue, or external local variable, inside the inner function. i.e., the external local variables the closure is closed on. And for C functions made available to Lua scripts: When a C function is created, it is possible to associate some values with it, thus creating a C closure (see lua_pushcclosure); these values are called upvalues and are accessible to the function whenever it is called. - http://www.lua.org/manual/5.2/manual.html http://www.lua.org/manual/5.2/manual.html