Skip to main content

Callback objects

Command, View, and GameEvent userdata is valid only until its callback returns. Copy scalar values or returned snapshots if needed later. Invalidated proxy reads return nil and writes do nothing; this does not make retaining them useful.

Command fields​

FieldTypeWritableMeaning
command_numberintegerNoCommand sequence number
tick_countinteger or nilNoBase command tick count
view_anglesVector or nilAssign VectorCopied angles; assign a Vector to update native angles
forward_movenumber or nilYesForward movement
side_movenumber or nilYesSide movement
up_movenumber or nilYesVertical movement
weapon_selectinteger or nilYesSelected weapon index; numeric assignment casts to native uint32
simulation_modeinteger or nilNoNative simulation mode
first_predictionboolean or nilNoNative first-time-predicted flag

Base-dependent reads can return nil without a base command. Unknown reads return nil. Writes to unrecognized/read-only names do not change native state; numeric validation may still raise an error. Editing a returned view_angles vector alone does not update the command: assign it back.

Command buttons​

Boolean button properties are readable and writable. Truthy assignment adds a native button; false/nil removes it. Every name below supports the short and in_ alias shown.

Short nameAlias
attackin_attack
attack2in_attack2
jumpin_jump
duckin_duck
forwardin_forward
backin_back
usein_use
leftin_left
rightin_right
move_leftin_moveleft
move_rightin_moveright

subticks​

command:subticks() returns an ipairs-style iterator triple: iterator, snapshot table, initial index. Use it directly in a generic for loop; it does not return only a table. Missing command/base/subtick data gives an empty iterator. Each Subtick record has the fields in returned structures.

history​

command:history() returns an ipairs-style iterator triple over HistoryEntry snapshots. Missing command/history gives an empty iterator. Native sparse entries can make ipairs stop at the first hole. See returned structures.

button​

command:button(name) accepts a button name or alias and returns a ButtonState table. An unknown string raises unknown command button; an invalidated command returns nil, reason. This records held/pressed/released/toggled/scrolled state without modifying it.

local traceless = require("traceless")
traceless.events.on("command.setup", function(command)
local state = command:button("jump")
if state and state.pressed then traceless.console.info("Jump pressed") end
for index, step in command:subticks() do
traceless.console.info(index, ": ", step.when)
end
end)

View fields​

x, y, and z are world origin numbers. pitch, yaw, and roll are angle numbers in degrees. fov is numeric field of view. All seven are readable and writable during override_view. Unknown reads return nil; unknown writes are ignored after numeric value validation. Invalidated view writes do nothing.

GameEvent fields​

event.name returns the event name. Dynamic fields first try a native string lookup, then an integer lookup with default 0. Unknown fields can therefore return 0 rather than nil. Invalidated events return nil. This proxy has no public writable fields and does not preserve arbitrary native float/boolean types.