lua-users home
lua-l archive

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


Once again..thanks...
Last one (maybe) for the moment..

I don't like having to have a 'named' table to hold all my 'tables'
i.e.
Config = {
		blah = {
		...
		..
		}
}

In that I need to do 

>>	lua_getglobal(mLuaVM, "Config"); 	<<
	lua_pushlstring(mLuaVM, Name, Len);
	lua_gettable(mLuaVM, -2);

Using my new ref thingy, Id like to create a base table, that the script
vars are loaded into..how do I do that?
And what are the limits for Refs? Do I have to free them?

-----Original Message-----
From: Ashwin Hirschi [mailto:deery@chello.nl] 
Sent: 26 September 2003 03:32
To: Lua list
Subject: Re: First post: Hierarchal Data storage...


> Is it possible to store off the current 'table address' held in the 
> stack, so I can quickly push it back later?

You can use:
- lua_ref to get an int reference to your table
- lua_getref to push your ref'd table back on the stack, and
- lua_unref to release the reference

This'll work in both Lua 4 and 5.

Ashwin.