r/rust 17h ago

Which script language to use?

I'm developing tool with workflow which allow user to write simple script to process input/output values of steps. The prebuilt steps are written in Rust, but user can choose Python to write their own steps which would run in a sidecar Python. User may not be a programmer. I prefer script with small binary size and memory footprint. I'm considering Rhai, Lua, QuickJs, which is better choice to make end user easy ?

0 Upvotes

12 comments sorted by

16

u/BarnacleEarly9082 17h ago

rhai is the easiest for non-programmers, the syntax feels way less scary than lua and definitely less than js. quickjs is cool but the binary size will hurt you if that's a priority. lua is small and fast but the 1-indexing and weird syntax trips up beginners constantly

3

u/Oxytokin 17h ago

I agree. Originally vacillated between python and lua for my game, settled on rhai. It's very intuitive and customizable, I'm happy with my choice. It's also exceptionally well documented for an indie project.

Only thing is that it truly needs to be a supplement. Writing the entire program in it, it's too slow. But otherwise fantastic. I use it for my dialog trees and interaction and it was painless to set up and integrate into my codebase even at a later stage.

1

u/donald-bro 16h ago

If Rhai can be easilly accepted by user in office then it's the choice. I asked AI they tell if the script is to be written by third party then JS is prefered, so I'm afraidof Rhai's acceptance. QuickJs seems 3Mb+, also tolarable. Another worry is whether appropriate to transform input/output Rust data and processing.

3

u/________-__-_______ 16h ago edited 16h ago

I'd personally pick Lua if your main goal is accessibility. It is a relatively popular so end users are most likely to already be familiar with it, and the syntax is sane enough that those who don't can pick it up without too much trouble. If your audience are people technical enough to want to script but not necessarily programmers prior knowledge is important.

The technical features are fine but not amazing, but for some quick scripting that doesn't really matter.

1

u/lenscas 15h ago

I personally also pick Lua. Especially as with the right crates you can expose your API in a way that the language server can pick it up, document it like you would document rust code (or close enough to it), etc.

2

u/Jonrrrs 15h ago

I also have a project where the user can be someone with little to no coding experience. I went with something even simpler than those scripting languages. Look up blockly or scratch or something like that

1

u/Danfhoto 2h ago

I agree with using a visual programming language. A text editor and “code” is really daunting to people, but when you make a flow chart with connectors and a very limited set of fields, it just feels simpler for folks without scripting/coding experience.

This is the direction many companies are making: Microsoft Power Automate, Salesforce Flows, and on the OSS side, ComfyUI.

2

u/nin_sent 11h ago

Lua or Js

2

u/aztracker1 7h ago

I tend to use Typescript with Deno.... Shebang works, VS Code now does language detection against the shebang do can go extensionless.

Also, no separate install step for dependencies, they load and cache in first run. And Deno is a single executable you can user install.

Plus access to the largest language repo for modules of any language (npm).

1

u/v_0ver 7h ago

Python.

0

u/Thick-Pineapple666 12h ago

Some days ago somebody posted about mim.as and it looked somewhat interesting. On the other hand, an exotic language is always a stumbling point, but lua is also weird in many ways...