'Lua getters and setters
I'm working with the Codea iPad app and learning Lua. Codea uses Class.lua for classes. What I'm trying to achieve is a way to specify functions for a variables get and set methods. Currently, a variable say "x" can be accessed liked this: print(obj.x) and set with code like this: obj.x = 1. I would like for the variable to instead call a get and set function I can specify. I'm porting something written in Actionscript 3 and need to mimic A3's get and set function declarations. Let me know if this is possible or if their is another way. I can override Codea's Class.lua if adding or altering its code is a solution. Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
