Re: Speed issue?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Speed issue?
- From: Graham Wakefield <lists@...>
- Date: 2008年3月26日 01:13:26 -0700
On Mar 25, 2008, at 9:25 PM, Eugen-Andrei Gavriloaie wrote:
L2 = lua_newthread(L);
lua_pushvalue(L, true);
Stack status: elem1 elem2 ..... elemN thread true [top of the stack]
lua_settable(L, LUA_REGISTRYINDEX); // pops the thread from the
parent state
This is translated into:
t[thread]=true. Is this correct?
Yes.
lua_pushthread(L2);
lua_pushnil(L2);
Stack status: elem1 elem2 ..... elemN thread nil [top of the stack]
lua_settable(L2, LUA_REGISTRYINDEX);
t[thread]=nil. Is this correct? If it is that means that putting
nil value into a table removes that pair?
Yes. Setting a value to nil in Lua removes a reference; any value
with no reference is available for garbage collection.