Re: Manipulating tables from c++
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Manipulating tables from c++
- From: Thomas Lavergne <thomas.lavergne@...>
- Date: 2002年7月09日 14:07:03 +0200
Do something like this :
1: lua_pushstring(L, "table1");
2: lua_newtable(L);
3: lua_pushstring(L, "table2");
4: lua_newtable(L);
5: lua_settable(L, -3);
6: lua_settable(L, LUA_GLOBALSINDEX);
Line 1 and 2 was for create the table1 and prepare for store it in globals.
Line 3 to 5 create the table2 and store it in table1
Line 6 store table1 in globals
Robert Sadedin wrote:
From c++, how would I go about create a table (referenced, let's say as
'table1'), and inserting a table into that table (referenced, as 'table2').
I would like to be able to call table1:table2:getFunctionValue(), and am not
sure how to go about this.
I understand that to create a table I need something like:
lua_newtable(L);
lua_setglobal(L, "table1");
lua_getglobal(L, "table1");
lua_settable(L, -3);
Is that correct so far, and if so, how do I add the second table?
Thanks for the help,
Rob
--
Thomas Lavergne "Le vrai rêveur est celui qui rêve
de l'impossible." (Elsa Triolet)
thomas.lavergne@laposte.net
d-12@laposte.net ICQ:#137121910 http://assoc.wanadoo.fr/thallium/