Loft

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.

Getting Started

Install

Get loft running and write your first Loft program in minutes.

Roadmap

Planned features for version 1.0 and beyond, with syntax previews.

Language

vs Rust

Key differences for developers coming from Rust.

vs Python

Key differences for developers coming from Python.

Keywords

Keywords and control flow

Texts

Text handling and functions

Integers

Whole numbers and arithmetic

Boolean

True, false, and null

Float

Floating point operations and math functions

Functions

User defined functions

Vector

Vector creation and use

Structs

Grouping related data with structs

Enums

Named choices with optional data

Sorted

Keeping records in sorted order automatically

Index

Fast lookup and range queries over records

Hash

Instant key lookup with a hash table

File

File system — text, binary, and directory access.

Image

Reading and examining PNG files

Lexer

Lexer library.

Parser

Parsing Loft source code programmatically

Libraries

Library system — importing and using external loft modules.

Store Locks

Immutability with const and runtime store locks

Parallel execution

Parallel processing with the par(...) for-loop clause

Logging

Recording events with the logging system

Random

Random numbers and random ordering

Time

Wall-clock time and elapsed time

Safety

Language traps and how to avoid them

Standard Library

Types

Primitive type conversions and null checks

Math

Arithmetic, rounding, and trigonometry

exp / ln / log2 / log10

min / max / clamp

Text

String manipulation and formatting

Collections

Vector, sorted, index, and hash operations

Output and Diagnostics

Print, assert, and diagnostic functions

Parallel

Parallel for-loop and worker functions

File System

File, directory, and path operations

Environment

Command-line arguments and program state

Random

Time