Types
Core types
Section titled “Core types”CommandCallback
Section titled “CommandCallback”The function passed to
usems.register_command. Invoked
by the engine whenever a player runs your command, once per dispatch.
type CommandCallback = (...args: string) -> ()Arguments are the console arguments after the command name, in order.
usems.register_command("my_give", function(item, count) -- console: my_give cubecar 3 print(("give %s x%s"):format(item, count)) --> give cubecar x3end, 0, "Give an item")FrameHookCallback
Section titled “FrameHookCallback”The function passed to usems.hook("frame", ...). Called
every rendered frame inside Source’s HudUpdate.
type FrameHookCallback = (dt: number) -> ()dt is frametime in seconds, read live from the engine’s gpGlobals.
usems.hook("frame", function(dt: number) -- integrate anything time-based: elapsed += dtend)TickHookCallback
Section titled “TickHookCallback”The function passed to usems.hook("tick", ...). Called
once per server tick inside GameFrame — 66/s in single-player, fixed
regardless of frame rate.
type TickHookCallback = () -> ()usems.hook("tick", function() -- fixed-rate simulation logic: sim_steps += 1end)ModManifest
Section titled “ModManifest”The parsed mod.toml, as consumed by the loader (see
Package Format). Scripts never see this table
directly — it’s shown here because usems.mod_name mirrors its name
field and validation errors reference these field names.
| Field | Type | Rules |
|---|---|---|
id |
string |
1–64 chars [a-z0-9_.-], starts alphanumeric; unique across packages. |
name |
string |
1–128 chars. |
version |
string |
1–128 chars, free-form. |
author |
string |
1–128 chars. |
language |
string |
"luau" today; others parsed but skipped. |
entry |
string |
Normalized relative path, inside the package, .luau for Luau. |
enabled |
boolean |
Optional, default true. |
Value rendering
Section titled “Value rendering”How print renders each Luau type:
| Type | Renders as |
|---|---|
string |
unquoted text |
number (integral) |
42 |
number (fractional) |
0.66666666666667 |
boolean |
true / false |
nil |
nil |
table |
<table> |
function / thread |
<function> |
userdata |
<userdata> |
vector |
<vector> |
| error values | <error: message> |
Planned types
Section titled “Planned types”These arrive with the entity/reflection tiers of Phase 7 and will get their own pages as they land:
Vector,QAngle,Quaternion,VMatrix— Source math types, native where Luau provides them (vector) and bridged where notCBaseEntityand the class hierarchy — entity handles with datamap field accessEHandle<T>— safe entity references across framestrace_t,Ray_t— trace results and inputs forutil::TraceLine-style functionsConVarRef— live reference to any engine cvar (not just USEMS-registered ones)GameEvent— event fields, listen/fire