-
Notifications
You must be signed in to change notification settings - Fork 0
Modules
No one wants to write code multiple times, right? Jask allows the definition of modules, a jask file containing code, which can be imported in other jask scripts:
; file myLib.jask
function aVeryUsefullFunction()
return "I am coming from a module!"
endThis file can now be imported in another script:
; file myScript.jask
use "myLib.jask" as myLib
print(myLib::aVeryUsefullFunction()Note that you can choose the identifier for an imported module freely. It is recommended to use an identifier, which is recognizable and meaningful for your purposes.
Jask consists not only of the interpreter, but also of a collection of helpful functions known as jcore. Jcore bundles a lot of common functionality, which is purely written in jask. It is meant as a demonstration of jasks capabilities and features. If you have implemented a usefull feature, help expanding jcore via a pull request!
Global variables in modules are not accessible from scripts importing the module. Structs, however, are globally accessible.