lua-users home
lua-l archive

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


>storing the lua value for my just created tables, and they work as 

>expected. Dirk said that this is not a good idea, because lua doesn't 

>assure the pointer stays valid, perhaps after a garbage collection


First of all, sorry - I don't understand how to post correctly under a 
given topic. It's easy to start a topic, not so easy to post a message 
and make it go under the correct thread.

Second, sorry again - I don't 
want to be pedantic, but someone could explain me better than the 
manual?
Here: http://www.lua.org/manual/5.2/manual.html#4.5the lua manual says 
that a host application can store data in the registry, and also says 
that "you should use as key a string containing your library name, ..., 
or any Lua object created by your code". What I understand is that "lua 
objects created by your code" means "created by the host application". 
If so, this implies that it is safe to take the lua value for an object 
(say, "its pointer"), and use it in whatever manner because that value 
will never change (as long as the object exists, of course). If such a 
value is good to be used as a key in the registry, it is also good to 
be used as a key in the host application. or not?

Thank you, regards,

Linuxfan