Basic "self/Namespace/super" question
I saw in Core/invitem where the handler for onDelete being registered was changed to self.onDelete. I have been playing for a bit but mainly in the style of looking at existing code and extrapolating, inferring how things are done. I am always WTF'ed when I try to google "lua when to use self" type questions cos of the examples with metatables colon and non-colon callls (ie syntactic sugar stuff) - I never use scripting languages other than bash mainly to start other apps or pass admin command; but I am very familiar with OOP in C++, Java as well as older languages.
So... "self" - this means the particular instance. Does that mean when you call self.onDelete it will always call the onDelete defined in that script. But calling without the self could call onDelete from a super class? So in that addHandler you are just being safe so that it will complain if you don't have onDelete defined or is it something else?
Then there is using the "namespace name" (terms again - like CharManager) - going by my C++/Java experience, I always assumed you are "locking" the call to the global methods in that namespace only. Like if you are writing a line of code in CharManager and do "CharManager.foo()" then it always calls the foo() in CHARMANAGER, even if CharManager is somehow "super" to a class that has "foo()" also defined. And that without CharManager part of the call it would then "find" that foo() instead. I am sure I am being more confusing than now in my question - I do better speaking since can pick up cues and adjust...
Any nuance or pointing to a forum thread is appreciated. I recall seeing these types of posts early on years ago. I expect many new people ask at least flavors of this. But searching on "self" for example gets too many hits and fails to execute. Even a decent "search term" would be all I need.
Thanks.
PS - "super" is at least clear ;) and I get how "self" works with the colon calling (which is what usually returns in my searches) as the first argument etc. I mean "self" in explicit calls.