Method (Section) — ClassySK
Addon: ClassySK · Category: Section · Since: 1.0.0
Syntax
(public|private) [static] <[\w_]+>\([<.+>]\) [(\:\:|returns|->) %-*classinfo%]Description
Methods are functions belonging to a specific class. The signature is very similar to that of regular functions. See the [**Official Wiki**](https://github.com/novystar/ClassySK/wiki/Tutorials%3A-Methods-%26-Access-Modifiers) for more information.
Examples
class Example:
public points: number
private static sayMessage(message: text):
broadcast {_message} # our message argument is available in '{_message}'
public giveApple(amount: number) :: item:
return {_amount} of apple
public getPoints() returns number:
return self::points
Counter::increment(1)
set {_count} to Counter::getValue()
{_myClass}::setPlayer(player)
set {_player} to {_myClass}::getPlayer()