lua-users home
lua-l archive

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


Is it possible to override the assignment operator of a lua variable? (e.g. "local var = 34;")

I have read the mailing lists, and it is possible using metatable functions (__index, __newindex) to make variables read only. Currently I am using this, but it is a suboptimal solution for my use-case (it prohibits bad stuff, but does not enable full behavior like overriding the assignment operator would)

I am using lua to represent relational data and some of my variables are indexes, so when they are changed, I need to trigger index changes.

So I need to do something like override the assignment operator for a variable, but I cant figure out how.

Anyone got any magic on this one?

- Jak