Problem With Class Functions Accessing "self"

Hello,

must admit that this confused the hell out of me as well when starting to get in touch with Lua.

To call a method in Lua, use the colon operator:

-> obj = SomeClass()
-> obj:some_method()

which is syntactic sugar for
-> obj.some_method(obj)

Same applies to method defs:
SomeClass:get_value()
– is the same as
SomeClass.get_value(self)

See also http://www.lua.org/pil/16.html#ObjectSec

Especially confusing is that properties do not need the colon.
-> obj.some_property

On a second though this makes sense though, because functions in Lua are first class functions, so a function is a property too, thus it’s invoked with the . operator.

See also luabind lua classes static non static for a few more infos about Renoises’s class impl