Enums
Enums are global tables of named constants, such as WeaponSlot.Primary or Key.F1. Pass them to the functions that expect them instead of writing the raw numbers, and compare what functions and events return against them. This page lists every enum table, the side it exists on, and where it is documented.
Available on: Server, Client (see each table)
Values
How enums work
- Every enum is a plain Lua table of numbers.
WeaponSlot.Primaryis just0,Key.F1is just112, so you can store, compare and send them over the network like any number. - Some enums are small consecutive integers (
WeaponSlot,TornadoState, ...). Functions that take them check the range and raise a Lua error such asinvalid weapon slot 7for a value that doesn't exist. - Some are bit flags (
AclLevel,RoadGraphType) that can be combined withbit.boror+and tested withbit.band(see Sandbox), or withHasAclforAclLevel. - Some are 32-bit hashes of game names (
Action,Ability,Bone,VehicleType,ForcePulseTuning, ...). Treat them as opaque identifiers.Hashcomputes the same hash from a name, for exampleHash("ACT_JUMP") == Action.Jump. - The tables are ordinary globals. Never assign to them: the functions don't read them, so changing a value only breaks your own comparisons.
To list a table's contents at runtime:
for name, value in pairs(WeaponSlot) do
print(name, value)
end
All enum tables
| Table | Side | What it is | Page |
|---|---|---|---|
AclLevel | Server, Client | Player permission flags (owner, admin, moderator) | acl-level.md |
NetObjectType | Server, Client | Kinds of networked objects (player, vehicle, NPC, ...) | net-object-type.md |
Resource | Server, Client | Resource.Name, the current resource's name | resource.md |
ResourceStatus | Server, Client | Whether a resource is running | resource.md |
ResourceAction | Server, Client | What a player's game did with a resource (start, stop) | resource.md |
Key | Server, Client (used on the client) | Keyboard keys and mouse buttons | key.md |
WeaponSlot | Server, Client | A player's weapon slots | weapon.md |
WeaponMode | Server, Client | A weapon's primary and secondary fire | weapon.md |
AmmoType | Server, Client | Ammunition types | weapon.md |
WeatherAct | Server, Client (used on the server) | Weather actions: spawn and remove the tornado | weather.md |
WeatherProperty | Server, Client (used on the server) | Weather settings: tornado and clouds | weather.md |
TornadoState | Server, Client (used on the server) | States of the tornado | weather.md |
VehiclePart | Server, Client | Doors, hatches and other moving parts of vehicles | vehicle.md |
VehiclePartState | Server, Client | Open / closed state of a vehicle part | vehicle.md |
VehicleSeat | Server, Client | Vehicle seats and stunt positions | vehicle.md |
VehicleType | Server, Client (used on the client) | Kinds of vehicles (car, boat, helicopter, ...) | vehicle.md |
POIType | Server, Client (used on the client) | Kinds of map and world markers | poi.md |
POIDisplayMode | Server, Client (used on the client) | Where a marker is shown (world, map, both) | poi.md |
MoveType | Server, Client (used on the server) | NPC movement speed | npc.md |
MoveStyle | Server, Client (used on the server) | NPC movement attitude | npc.md |
LookType | Server, Client (used on the server) | Whether an NPC looks with its head or body | npc.md |
RigidObjectMotionType | Server, Client | Static, keyframed or dynamic rigid objects | rigid-object.md |
Ability | Client | The local player's unlockable abilities | ability.md |
Action | Client | Character acts (jump, crouch, ragdoll, ...) | action.md |
InputAction | Client | Player input actions | action.md |
PfxLayer | Client | Physics collision layers for raycasts | pfx-layer.md |
Bone | Client | Character skeleton bones | bone.md |
GameState | Client | The game's startup and loading states | game-state.md |
CharacterAttachedEffect | Client | Visual effects played on a character | character-attached-effect.md |
CameraShakeType | Client | How a camera shake moves the camera | camera-shake-type.md |
WaterBoxStyle | Client | How a water box fits the terrain | water-box-style.md |
ForcePulseCategory | Client | Kinds of explosion push | force-pulse.md |
ForcePulseTuning | Client | The game's built-in explosion tunings | force-pulse.md |
RoadGraphType | Client | Kinds of AI routes (road, sea, air, footpath, railway) | road-graph-type.md |
Where enums are used
| Enum | Used by |
|---|---|
AclLevel | client:GetAcl(), client:HasAcl(level), client:SetAcl(flags) (PlayerHandle) |
NetObjectType | World.GetAllByType(type), object:GetType() |
Resource, ResourceStatus, ResourceAction | Resources.GetAll(), resource:GetStatus(), the OnPlayerResourceAction event |
Key | Input.IsKeyDown, Input.IsKeyPressed, Input.IsKeyReleased, the OnKeyDown, OnKeyUp, OnMouseDown events |
WeaponSlot, WeaponMode, AmmoType | player:GiveWeapon, RemoveWeapon, GetWeaponName, GetWeaponAmmo, SetWeaponAmmo, GetInventoryAmmo, SetInventoryAmmo (PlayerObjectHandle) |
WeatherAct, WeatherProperty, TornadoState | Weather.SyncAct, Weather.SyncProperty (server) |
VehiclePart, VehiclePartState | vehicle:GetPartState, vehicle:SetPartState (VehicleHandle), the OnVehiclePartChangedState event |
VehicleSeat | player:WarpIntoVehicle, the OnPlayerVehicleEnter and OnPlayerVehicleExit events |
VehicleType | vehicle:GetVehicleType() (client) |
POIType, POIDisplayMode | World.SpawnPOI (client) |
MoveType, MoveStyle, LookType | npc:Move, npc:Follow, npc:LookAt (NPCHandle, server) |
RigidObjectMotionType | World.SpawnRigidObject, rigidObject:SetMotionType, RigidObject:SetMotionType |
Ability | Local.LockAbility, Local.UnlockAbility, Local.IsAbilityUnlocked |
Action | Local.PlayAction |
InputAction | Input.GetValue, the OnLocalPlayerInput event |
PfxLayer | Physics.Raycast |
Bone | player:GetBonePosition (client) |
GameState | Game.GetState() |
CharacterAttachedEffect | player:PlayAttachedEffect (client) |
CameraShakeType | Camera.SpawnShake |
WaterBoxStyle | World.SpawnWaterBox (client) |
ForcePulseCategory, ForcePulseTuning | World.SpawnForcePulse (client) |
RoadGraphType | RoadGraph.GetSamples, RoadGraph.GetEdge |