RuneScript documentation
A practical tour of the RuneScript features that exist today. Every complete program in these pages is compiled by the test suite, so if one stops compiling, the build fails.
- Getting startedBuild the CLI and run your first program.
- Language specificationThe grammar and rules, each with its implementation status.
- DiagnosticsEvery error code the compiler and runtime can report.
- ExamplesComplete programs with their real output.
The guide
- Getting startedBuild the CLI, run a program, run --watch.
- Program structurePackages, comments, main.
- Types and variablesInt, uint, bool, string, assignment.
- OperatorsArithmetic, comparison, logic.
- Control flowIf, while, for, break, continue.
- FunctionsParameters, return values, recursion.
- Output with traceTo print one string built from several values, join them with + or use an interpolated string such as $"{name} is {age}" ([chapter…
- Diagnostics referenceEvery error and warning code, -Werror, --allow.
- Coming from ActionScript 3AS3 lets you write if (count) or if (name). RuneScript requires a bool, so write if (count != 0).
- Standard library: std:stringGo's strings, in RuneScript.
- Compiling to JavaScriptRunescript build, how strict typing is kept, calling JavaScript with extern, and live reload with runescript dev.
- Packages and filesUse, multi-file programs, visibility.
- Floats and conversionsFloat, float32, float64, (int) x.
- Errors: throw, try, catch, finallyThrow, try, catch, finally, and catching runtime errors.
- Web pages with rune:domComponents, checked HTML and SVG templates, runes, events, $if, renderApp.
- Text and lists: joining strings, char, and arraysJoining strings with +, interpolated strings $"…", char, and Array<T>.
- No null, no any, no genericsWhy, and how to use false where other languages use null.
- Numbers in depth: widths, literals, bits, and std:mathInt8 … uint64, hex and binary literals, bit operations, std:math.
- StructsDeclaring, building, and copying value types.
- Files, input, and outputStd:io, std:process, std:fs, std:path, and a Brainfuck interpreter.
- JSON: std:jsonStd:json: parsing, reading with checked functions, building, and writing JSON.
- CSV, matrices, and versionsStd:csv, std:matrix, and std:semver.
- EditorsVS Code, Vim, Neovim, and Emacs, and the language server runescript lsp.
- ClassesFields, methods, constructors, this, and objects as references.
- Graphics on desktop and in the browserWindows, drawing, input, textures, and widgets.
Not yet available: class inheritance, struct methods, and objects, arrays, structs, or callbacks across the JavaScript boundary. Full JavaScript compatibility isn't promised yet; strict checking is. Reserved keywords give a clear “not implemented yet” error. See theroadmap.