Running Nyx Scripts
Running Nyx Scripts
Section titled “Running Nyx Scripts”Execute Nyx scripts (files ending with .nyx
) from your command line:
nyx path/to/your_script.nyx
Accessing Command-Line Arguments
Section titled “Accessing Command-Line Arguments”Pass arguments to your script after the script name. They are available in Nyx as a global list of strings named SCRIPT_ARGS
.
nyx your_script.nyx arg1 "hello world" 123
Inside your_script.nyx
:
output("First script arg: #{SCRIPT_ARGS[0]}");output("Number of args: #{len(SCRIPT_ARGS)}");
The output:
// SCRIPT_ARGS is ["arg1", "hello world", "123"]