lua-users home
lua-l archive

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


Is there any way to set the value of a global variable from C by using its lua_Object instead of its name? To make a long story short, I have a class that contains a lua_Object (a table), and methods for reading and writing data in that table. When the class is created, it loads a file that contains the definition of one table, and the filename matches the name of the table inside. Then it gets the lua_Object by passing the filename string to lua_getglobal(). Before, I had the class set up so that it stored the name of the global, but that was a horrible waste, because the object would then be cloned, and the name string would not be needed. Anyway, I need to somehow set the value of the global variable with the lua_Object, so I can have it garbage-collected when the class is deleted. Any way to do this? If not, how can I write a function to do this?

=^_^=
----------------------
Do you do Linux? :) 
Get your FREE @linuxstart.com email address at: http://www.linuxstart.com