[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua persistent tables
- From: Steven Frank <stevenf@...>
- Date: Tue, 18 Mar 2003 00:18:00 -0800
I ported the Lua persistent tables example:
http://lua-users.org/wiki/PersistentTables
...to Lua 5.0, but I noticed there is a fundamental flaw -- the
__newindex metamethod is only called if the current value at the index
is nil.
Ie; it only works if you do this:
persistent_table[0] = nil
persistent_table[0] = "new value"
If you miss the first line, and that index already has a value, the new
value doesn't get saved... Any ideas?
Steven