RhaiScript, a scripting language written in Rust
Provides a safe and easy way to add scripts to any application.
Rhai is simple and similar to JavaScript+Rust with dynamic typing. According to tests performed, it proved to be quite efficient, achieving 1 million iterations in 0.3 seconds on a single-core 2.3 GHz Linux VM.
It has tight integration with native Rust functions and types, including getters/setters, methods, and indexers.
Installation
You will first need the following dependencies:
After that, proceed as follows:
Clone the repository:
git clone https://github.com/rhaiscript/rhai
Enter the repository and build:
Before that make sure you have
cargo
in your$PATH
, example for Bash:
echo 'export PATH="${PATH}:${HOME}/.cargo/bin"' >> ~/.bashrc
source ~/.bashrc
execute $SHELL
And then run:
cd rhai
charge install --path . --bin rhai-run
After that you can go out and remove the directory:
cd ..
rm -rf rhai
Hello, RhaiScript!
To test a Hello. World! create a file with the extension .rhai
, example: vim hello.rhai
And add the code below:
print("Hello, Rhai!");
To run it use the rhai-run
command:
rhai-run hello.rhai
For more information visit here .
Comments