[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Modifying referenced data
- From: "Peter Prade" <Peter.Prade@...>
- Date: Fri, 31 Jan 2003 14:25:30 +0100
> 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).
Cheers,
Peter