Talk:Object Oriented scripting shell
Jump to navigation Jump to search
_return = [player, 1, "Hello"] call BIS_OO_MyClass_myMethod;
The methods defined within a class can't use the values of an instance of the class. For me, there is no advantage against using cfgFunctions.
- yeah, seems like all functions are "static" and you would need to pass the class instance as parameter, which is not really OO --T_D 21:37, 1 December 2010 (CET)
- I'm aware the framework is not fully OO. It is meant to leverage some of the benefits of an OO architecture and it does. It prevents having to store data in global variables, arrays, etc. because it packs any data belonging to a particular class neatly in instantiated objects (Logics). You don't have to set up these variables for every instance; it's done for you. It organizes responsibility by placing methods with corresponding classes. Finally there's automatic validation which ensures you're feeding methods the right amount and types of parameters (very convenient in debugging!). Overall it has massively helped us make complex scripted systems more manageable.
- Not having access to _this in method scripts is a flaw, which hopefully can be corrected in future versions. For now you can either pass instances in the methods, or bypass by storing important instances in global variables. --Joris 09:57, 3 December 2010 (CET)