lua-users home
lua-l archive

Re: Storing Variable Properties

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


> Is there a way to set a flag or property on a lua variable such that
> when it gets modified a callback can be invoked?
In Lua `variables' are stored in tables. The Lua way to trap modifications
on a table is by using metamethods. You have to take some care because
write access (through __newindex) is only trapped for keys that are not yet
in the table, etc.
I would certainly try this `official' approach before diving into the Lua
sources. Write me if you need some hints.
--
Wim

AltStyle によって変換されたページ (->オリジナル) /