This language reference manual will not cover the basics of programming, instead it’s a reference manual for the language.
If you want to test out the language there is a REPL command available over SSH and in the web UI. The web UI also features a scripting area to run block code.
Variables may store values from expression (e.g. constants or function calls) or callable function objects such as anonymous functions and named function pointers. In HSL variables are prefixed with
$ followed by
[a-zA-Z_]+[a-zA-Z0-9_]*. Variable names are case-sensitive. Some variables are read-only, hence they are not allowed to be assigned to (primarily pre-defined variables in contexts). Variables are assigned by value (copy-on-write).
$var = "foo"; $bar = $var; $bar = ""; // $var is still "foo"
Variables in HSL are main/function scoped. However a variable needs to be created in all code paths before being used.
isset() may test if a variable exists.
A lot of builtin functions are available in the function library. Functions are called by named followed by parentheses
() with input parameters in between them. Function names are case-sensitive. The argument types must be supported by the function, otherwise an error will be raised. It’s also possible to create user-defined functions.
echo uptime(); echo strlen("Hello");
Calling a function with too few or too many arguments will raise an error, either during compilation time or at runtime (using argument unpacking).