Standard Library

The Lux standard library is intentionally small. It does not patch table, string, math, or GMod globals, and it does not wrap values in chainable objects. You import the modules you need explicitly; generated Lua turns those imports into ordinary locals.

@lux/std

@lux/std is usable from pure Lua/GLua code and does not depend on GMod globals.

  • arr for dense one-based arrays
  • dict for key/value tables
  • set for boolean set tables
  • str for string utilities
  • num for numeric helpers
  • func for tiny function helpers
  • pool for table reuse
@lux/std imports
import { arr, dict } from "@lux/std"

local names = arr.map(players, (player) => player:Nick())
local merged = dict.merge(defaults, overrides)

Allocation-aware APIs

APIs with simple names may allocate and are suitable for one-off transforms or non-hot paths.

Allocating helper
local mapped = arr.map(xs, (x) => x + 1)

APIs ending in Into or InPlace reuse caller-provided tables:

Caller-owned output tables
arr.mapInto(xs, (x) => x + 1, out)
arr.removeWhereInPlace(xs, (x) => x == nil)
dict.mergeInto(out, defaults, overrides)

Use these in HUD paint, Think hooks, VGUI layout, and other per-frame paths.

@lux/gmod

@lux/gmod is the GMod-specific helper package. It may use globals such as IsValid, hook, timer, net, util, player, ents, Color, and vgui.

  • valid
  • hookx
  • timerx
  • netx
  • json
  • players
  • entsx
  • color
  • vgui
@lux/gmod imports
import { valid, hookx, players } from "@lux/gmod"

hookx.add("Think", "my_addon.tick", () => {
  local out = {}
  players.aliveInto(out)
})

netx.register uses a server { ... } realm block internally so util.AddNetworkString is emitted only into the server artifact.