Open oomek opened 3 years ago
err, that would break semantics and , most important, totally breaks the accessibility of the instance. You could NEVER EVER access any member or function of that instance again, or not even be able to create an instance if _get would work that way you want. Example: class foo { function _get() { return 5 ; } //yes, we return an integer value here to epicly slap your face! function bar() { print("Called bar\n") ; }
local inst = foo() ; //would thow an error, as "foo" would return 5 and that translates to: // local inst = 5() so you would try to call an integer value. -> Crash
even if instantiation is done in another way, same applies for:
inst.bar() ; //what would 5.bar() result in? Yes, "Trying to call an integer value"
I'm struggling with intercepting a _get call with no provided index. I would need to return one of the objects inside the class when only the instance name is used and pass it as a function parameter. Is there any way that would give such functionality, or some workaround maybe?