lua-users home
lua-l archive

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


Hi,

Suppose we have a table initialized in lua as follows:

A=
{
	B=
	{
		C=
		{
			key="value",
		},
		another_key="another_value",
	},
	yet_another_key="yet_another_value"
}

Now, I would like to access A.B.C.key or A.B.another_key

As far as I know this can be accomplished by doing lua_getglobal/lua_getfield.
Is there any way of doing this in a simpler way? 

luaL_register already does writing in this manner. For example, we can do:

luaL_register(L,"my.complex.package.api",pAPI)

where pAPI is luaL_Reg *pAPI

Cheers
------
Eugen-Andrei Gavriloaie
Web: http://www.rtmpd.com