Skip to content
Talk to our solutions team

Choose a language for a script

The right language for the job, and proof the engine accepts your file as that language.

Picking a language by preference and finding out at deploy time that the engine rejects it is an expensive way to learn the list.

--runtimeUse for
javascriptThe default choice. Full control flow, objects, the host namespaces
luaSmall, fast, familiar to game and embedded teams
starlarkDeterministic and sandboxed by construction — a good fit for untrusted logic
exprA single expression, not a program
goInterpreted Go, for teams already writing it
wasmA precompiled module
Terminal window
kis script compile transform.js --runtime javascript
Compiling with javascript runtime...
✓ Compilation successful (95.377µs)
Source size: 59 bytes

Step 2 — read a rejection as information

Section titled “Step 2 — read a rejection as information”

Compiling the same JavaScript file under each language is a quick way to see what each one is:

Terminal window
$ kis script compile hello.js -r lua
error: hello.js line:1(column:17) near '{': syntax error
$ kis script compile hello.js -r expr
error: unexpected token Identifier("main") (1:10)
$ kis script compile hello.js -r wasm
error: invalid magic number

Each failure names the real reason: Lua does not use braces that way, expr wants an expression rather than a function declaration, and wasm expects a binary rather than text.

Starlark accepting a JavaScript-shaped function is not a licence to write JavaScript in it — the syntaxes overlap far enough to compile and diverge quickly after that.

A language chosen at the terminal is not a decision anyone else can see. Put it where it runs.

- name: transform
script:
language: starlark
file: ./classify.star
namespaces: json,string
setvar: classified

language: is explicit even when the extension already implies it — the file may be renamed, and the flow is what actually decides. Pairing it with namespaces: is the combination worth reaching for on generated code: a language that contributes no authority, and a grant that gives it none.

The scriptLanguage
Calls host namespaces, has real control flowjavascript
Is untrusted or generated, and should be constrained by constructionstarlark
Is one condition or one calculationexpr
Is CPU-heavy and precompiled elsewherewasm
Is maintained by a team that already writes Lua or Golua or go

Compile under the language you will actually configure, not the one you assume. A file that compiles as javascript says nothing about whether it compiles as starlark.