A statically-typed scripting language inspired by Rust.
v0.8.0
Welcome to Loft! Loft is a concise, statically-typed language designed to be safe and easy to embed in larger Rust projects. It is great for scripting game logic, configuration, data transformations, and anywhere you want a friendly language backed by a fast Rust runtime.
These documentation pages are your guided tour — each page is also a live test, so every example you see has already been verified to work exactly as shown. The best way to get started is to read the pages in order. This first page introduces the handful of ideas that shape every other part of the language.
Key differences for developers coming from Rust.
Key differences for developers coming from Python.
Keywords and control flow
Text handling and functions
Whole numbers and arithmetic
True, false, and null
Floating point operations and math functions
User defined functions
Vector creation and use
Grouping related data with structs
Named choices with optional data
Keeping records in sorted order automatically
Fast lookup and range queries over records
Instant key lookup with a hash table
File system — text, binary, and directory access.
Reading and examining PNG files
Lexer library.
Parsing Loft source code programmatically
Library system — importing and using external loft modules.
Immutability with const and runtime store locks
Parallel processing with the par(...) for-loop clause
Recording events with the logging system
Random numbers and random ordering
Wall-clock time and elapsed time
Language traps and how to avoid them
Primitive type conversions and null checks
Arithmetic, rounding, and trigonometry
String manipulation and formatting
Vector, sorted, index, and hash operations
Print, assert, and diagnostic functions
Parallel for-loop and worker functions
File, directory, and path operations
Command-line arguments and program state