[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Accessing nested tables from C/C++
- From: C++ RTMP Server <crtmpserver@...>
- Date: Mon, 4 Apr 2011 21:59:56 +0300
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