A number of Rhai-driven tools can be found in the
It is possible to turn these tools into Domain-Specific Tools.
|runs Rhai script files|
|a simple REPL tool|
|the Rhai Debugger|
For convenience, a feature named
bin-features is available which is a combination of
To install all these tools (with full features), use the following command:
cargo install --path . --bins --features bin-features
cargo install --path . --bin sample_app_to_run --features bin-features
Tools can also be run with the following
cargo run --features bin-features --bin sample_app_to_run
rhai-repl is a particularly useful tool – it allows one to interactively try out
Rhai’s language features in a standard REPL (Read-Eval-Print Loop).
Filenames passed to it as command line arguments are run and loaded as Rhai scripts before the REPL starts.
The following test functions are pre-registered, via
They are intended for testing purposes.
|returns a string with both numbers|
|displays the parameters and add |
The following command first runs three scripts –
loading the functions defined in each script into the global namespace.
Then it enters an REPL, which can call the above functions freely.
rhai-repl init1.rhai init2.rhai init3.rhai
rhai-run to run Rhai scripts.
Filenames passed to it as command line arguments are run in sequence as Rhai scripts.
The following command runs the scripts
script3.rhai in order.
rhai-run script1.rhai script2.rhai script3.rhai
rhai-dbg to debug a Rhai script.
Filename passed to it will be loaded as a Rhai script for debugging.
The following command debugs the script