[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua5 local scoping
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Sun, 1 Jun 2003 20:20:14 +0200
> Does this mean,
> that the VM code is somehow altered for the function that goes out of
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.)