-
Notifications
You must be signed in to change notification settings - Fork 0
DSL: functions
Timothé ROSAZ edited this page Sep 25, 2025
·
1 revision
Some spell files can be a function instead.
- Either move the file in the
/functionsfolder (instead of/spells) ; - Either use the
@functionannotation at the start of your spell.
All functions will have the following annotations :
-
@function([string])with an optional identifier. If the identifier is different from the file-name, it will be used instead. -
@param(<string>, <string>)declare a parameter. You can have as much as needed.- The first argument is the name of the variable that will be injected.
- The second argument is the type of the parameter.
-
@output(<string>, <string>, [boolean])declares the output of the function.- The first argument is the name of the variable to output.
- The second argument is the type of the output.
- The last argument is optional, default value is
false. Iftrue, it will consider the output as a list instead of a single element.
A basic example can be:
@function("add_numbers")
@param("a", "number")
@param("b", "number")
@output("c", "number")
%c = %a + %b;This method can then be used in a spell like this :
%solution = add_numbers(35, 7);
send to %caster message "The answer is %solution.";