lua-users home
lua-l archive

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


> Does this mean,
> that the VM code is somehow altered for the function that goes out of
> scope?

Functions that are exported out of (and hence survive) a scope you mean.

No, not the VM code itself changes, only a pointer to where the value
resides. (Being a stack slot or the private structure value.  This pointer
is in fact part of this private upvalue structure.)  Lua byte code always
remains unchanged.  Only local values, upvalues, table entries (including
the global environment), metatables and closure environments can be changed.
(From Lua scripts that is, the C API can change userdata as well.)

Bye,
Wim