lua-users home
lua-l archive

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

Thanks very much, I'll have a go at it later on.
Thanks again.

----- Original Message -----
From: "Thomas Lavergne" <>
To: "Multiple recipients of list" <>
Sent: Tuesday, July 09, 2002 10:07 PM
Subject: Re: Manipulating tables from c++

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
> I would like to be able to call table1:table2:getFunctionValue(), and am
> 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)    ICQ:#137121910