lua-users home
lua-l archive

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


> How can I modify a referenced data? For instance:
>
> // create a table
> lua_newtable( L );
> // set table[0] = number
> lua_pushnumber( L, number );
> lua_rawseti( L, -2, 0 );
> // reference the table
> int ref = lua_ref( L, lock );
>
> // ... somewhere later in the code
> // get referenced table
> lua_getref( L, ref );
>
> now I can read table[0], but how could I change the value of table[0]
> such as next time I do lua_getref( L, ref ) I will get modified table?

Ummm... I was under the impression the scenario you describe is already
possible. I hope it is, since I've been using a similar scheme in one of my
commercial (Lua 4-based) projects [;-)].

Ashwin.