Modules
Modules are a set of functions defined in a separate file. Modules can either be python files or ".mgarm" files. To create a python module simply create a regular python file with your code in functions. Then to use it use the "usemod" function as shown below:
usemod /testmod.py hello()
This will use the module "testmod.py" located in the root directory of your system, and then execute the hello() function within it. This allows for the expansion of GarmScript into the world of python libraries.
.mgarm Modules
A ".mgarm" module can be created with the following format:
hello {echo HELLO}
Or for multi line functions:
world ...
echo HELLO
echo WORLD
end
Then they can be used with the following similarly to python modules:
% This will use the function "hello"
usemod /test.mgarm hello
% This will use the function "world"
usemod /test.mgarm world
.mgarm Example
rand ...
setvar randomnumber $random 0 10
echo Random Number!
echo $randomnumber
end
Usage:
usemod /test.mgarm rand