Skip to content

Quick Reference

Built-ins

Always available, with no namespace. The generic built-ins (len, str, num, push, pop) are dispatched by static type at compile time.

Signature Notes
len(x): num length of a str, list, or map
str(x): str num, bool, or str to text; integers print clean
num(s: str): num? parse; nil on failure (including "")
push(xs: list<T>, v: T) append
pop(xs: list<T>): T? remove and return last; nil when empty
floor(x: num): num ceil(x: num): num
abs(x: num): num sqrt(x: num): num
min(a: num, b: num): num max(a, b): num
sin(x: num): num cos(x: num): num radians
atan(y: num, x: num): num two-argument arctangent
pi constant, 3.14159…
rand(): num uniform [0, 1); same sequence everywhere
srand(seed: num) reseed for replayable runs
env(name: str): str? read an environment variable; nil if unset
check(cond: bool, msg: str) runtime assertion

The lt.* engine interface

Call Notes
Frame and screen
lt.W lt.H constants 400, 240
lt.clear(r,g,b) clear colour and depth
lt.time(): num seconds since boot
lt.screenshot(path: str) save frame as BMP
lt.quit() lt.escape_quits(enable: bool)
3D scene
lt.camera(ex,ey,ez, tx,ty,tz, fov=55) position and look-at
lt.light(dx,dy,dz, ambient=0.35) directional light
lt.point_light(i, x,y,z, radius, r=1,g=1,b=1) slots 0–3
lt.fog(start, end, r,g,b) linear by depth
Meshes
lt.cube() lt.plane(segs=1) unit primitives
lt.sphere(seg=12) lt.cylinder(seg=16) lt.cone(seg=16)
lt.mesh(verts: list<num>): num 12 floats per vertex
lt.load_mesh(path: str): num Wavefront OBJ
lt.draw(m, x,y,z, rx,ry,rz, sx,sy,sz, r,g,b, tex=-1) lit draw
lt.draw_lerp(a, b, t, …, tex=-1) keyframe tween
lt.billboard(tex, x,y,z, w,h, …) camera-facing quad
lt.shadow(x,y,z, radius, alpha=0.35) grounding blob
2D
lt.rect(x,y,w,h, r,g,b, a=1) filled, alpha-blended
lt.load_texture(path: str): num BMP; magenta is transparent
lt.sprite(tex, x,y, sx=1,sy=1) top-left anchored
lt.sprite_ex(tex, cx,cy, sx,sy, rot,r,g,b,a) centre, rotate, tint
lt.sprite_uv(tex, x,y,w,h, u0,v0,u1,v1) atlas sub-rect
lt.print(text: str, x,y, r=1,g=1,b=1,a=1) 8×8 font
Audio, input, saves
lt.load_sound(path: str): num WAV
lt.play(sound, volume=1, loop=0): num channel, or −1
lt.stop(channel) lt.volume(v)
lt.key(name: str): bool held
lt.pressed(name: str): bool went down this frame
lt.gamepad(): bool lt.rumble(low, high, ms)
lt.save(name: str, data: str): bool binary-safe
lt.load_save(name: str): str? optional; nil when unreadable

Input names: left right up down z x c space return escape a s d w. On a gamepad, the d-pad and stick map to the directions, and A, B, Y, Start map to z, x, c, return.

Bits and register widths (0.3)

bit_and, bit_or, bit_xor, bit_not, bit_shl, and bit_shr accept unsigned 32-bit integers. Shift counts are integers 0–31. u8 and u16 wrap safe integers modulo 256 and 65536. hex(n, width=1) and bin(n, width=1) format unsigned values with minimum-width zero padding (1–8 and 1–32); no truncation. All functions reject invalid numeric domains at runtime. See Chapter 9.