3 ms·
I think you mean function object:method(arg) ... end, if you're assuming that object will be passed (as "self") implicitly. The colon is the difference from nor
by silentbicycle 18y ago
I think you mean function object:method(arg) ... end, if you're assuming that object will be passed (as "self") implicitly. The colon is the difference from normal map indexing.
I much prefer Lua's solution for this over Python's (and I'm also coming to strongly prefer prototype-style OO, in general).
- bayareaguy 18y agoIndeed, you are correct. function obj:method(arg) .. end is the same as function obj.method(obj,arg) .. end I think the reason I mentioned the latter is I generally use Lua closures to code the way Eckel preferrs. "Objects are a poor man's closures" -- Norman Adams