lua-users home
lua-l archive

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


Well, I figured that __newindex would get called every time one of the "special" table keys is mutated because I don't call rawset on the table in that case. Similarly, __index would be called every time one of these keys was accessed, and rawget would not be called as a result. The reason I can't store copies of values like "speed" that are stored in the corresponding C++ object is because these may be further manipulated by the engine (for example, speed may be set to 0 automatically if the sprite bumps into a barrier).

Tim

On Oct 22, 2003, at 9:23 PM, Nick Trout wrote:

Just a note in case you get stuck: new index will only fire the first
time set is called so you need to attach the metamethods to a proxy
table (which remains empty) and all the values go in a seperate values
table.

Nick