I'm writing a script in lua, what i need to do is run a piece of code every time a variable is set.
The code i have is:
plane = {}
plane.status = "foo"
plane.status = "bar"
I want to run this every time a value is assigned to a variable in plane
print "status=" + <value>
How would i go about this? i've head it has something to do with __newindex.