OWScript
OWScript copied to clipboard
Add support for static class methods
In the following example, Success can be a static method allowing usage as Sound.Success():
class Sound:
%PlaySound(type)
Play Effect
Visible_To: Event Player
Type: type
Color: White
Position: Event Player
Radius: 50
%Success()
this.PlaySound(Buff Explosion Sound)
Will there be a way to differentiate a static method from a class method? Nobody would want, e.g., Sound.play() to behave weirdly because it's not tied to an instance which defines what sound should play.
If you mean semantically, yes. The above is just an example of a scenario where a static method could be used. Adapting Python's grammar of @staticmethod is one option of a noticeable difference. Right now I am leaning toward a static keyword in front of method definitions.