lua-users home
lua-l archive

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

> 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?

think of the table as a container. the container stays unchanged (so the
table value remains the same all the times you get it via lua_getref( L,
ref ))
but the contents of that table can change anytime - and these changes take
place in all references of that table.

so it already works like you want it. you get the modified table next time.

if you want to make "local" changes to a table, that don't affect all other
references of it, you have to clone it first (create a new table with the
same contents).