Script language for rust like C++ has got Lua?

I am pythonist and i was wondering if Rust works with a special script language
like Lua is for C++ ?

There are bindings for lua and python if you need them. There is also Dyon. You may find others on crates.io.

2 Likes

Just a little nitpick.

Lua is written in C, not C++.

C++ has to work with the C API, which limits what you can do.

There is also Rhai: https://github.com/jonathandturner/rhai/blob/master/README.md

There was another one at some point.. can't seem to remember it at the moment though.

There's gluon which looks interesting if you want a more statically-typed language.

Here is an overview of languages implemented in Rust that may help you, too:

https://github.com/ruse-lang/langs-in-rust

3 Likes

Just a note. Gluon uses a GC (garbage collector) and this is a red flag.

They claim it being a per thread GC is (I agree) quite efficient. But only for certain use cases. It doesn't sound very COW (Copy on write) friendly.

What about Copy and Clone Traits? This appears to be an anti-pattern.

Great syntax though. Link:

I use Lua from Rust at work, and it works quite well.

Just like Lua does. AFAIK virtually every embeddable language uses GC of one kind of another.

5 Likes

A a new user of Rust one of the first things I wanted to do was see how it goes compiling Rust to WASM and running the code under node.js and in the browser. Very well as it happens.

So with this question I'm thinking it would be appropriate to use Javascript from natively built Rust.

It should not be so hard to get a JS interpreter like JerryScript embedded in a Rust program: https://jerryscript.net

thank you everybody.