|
|
||
|
On 1-Jun-06, at 2:38 PM, Roberto Ierusalimschy wrote:
Are there any guarantees made with regard to the validity of pointers inside Lua code? That is, suppose we look at luaV_execute -- is the TProtoFunc* guaranteed to be valid after the luaV_execute call finishes, or are internal pointers (which are derived from lua_Object's) liable to be garbage collected like everything else?
Lua code does not bother to clear pointers it is not going to use
again, and/or to correct them before it needs. So there are several
places along the code where pointers may be invalid. For instance, in
luaV_execute there are several calls that potentially may reallocate the
stack and therefore invalidate 'ra'. But 'ra' is corrected only when/if
needed.
-- Roberto