Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

types

Engine-canonical type aliases (vec3, vec2, quat, color). Marked --!global-types, so the runtime universe publishes these declarations into its globals bucket — every typed function across every source resolves these names without an explicit per-file import.

Exports

This module returns an empty table — its purpose is the export type declarations, which the typed-source pipeline picks up from the file's declaration block.

Types:

  • vec3 = { x: number, y: number, z: number } — 3D position / direction / vector.
  • vec2 = { x: number, y: number } — 2D position / direction / vector.
  • quat = { x: number, y: number, z: number, w: number } — unit quaternion.
  • color = { r: number, g: number, b: number, a: number? } — RGBA color; alpha optional.

Usage

-- No require needed. Just reference the type names directly:
typed function spawnAt(pos: vec3): string
    return entity.spawn("at", { position = pos }).id
end

local c: color = { r = 1, g = 0, b = 0 }  -- alpha defaults to nil

A user library can ship its own --!global-types module to publish additional canonical types; engine + library globals coexist via last-writer-wins on name collision.

Notes

  • --!global-types is what promotes the declarations into the globals bucket. Removing it makes the types module-scoped — no other source would see them without an explicit import.
  • Per-source export type declarations shadow globals when names collide, so a module can still redefine vec3 locally if it really needs to.
  • The module body itself is intentionally empty (return {}) — there's no runtime surface here, only the type declarations.