Skip to main content

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.Primary is just 0, Key.F1 is just 112, 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 as invalid weapon slot 7 for a value that doesn't exist.
  • Some are bit flags (AclLevel, RoadGraphType) that can be combined with bit.bor or + and tested with bit.band (see Sandbox), or with HasAcl for AclLevel.
  • Some are 32-bit hashes of game names (Action, Ability, Bone, VehicleType, ForcePulseTuning, ...). Treat them as opaque identifiers. Hash computes the same hash from a name, for example Hash("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​

TableSideWhat it isPage
AclLevelServer, ClientPlayer permission flags (owner, admin, moderator)acl-level.md
NetObjectTypeServer, ClientKinds of networked objects (player, vehicle, NPC, ...)net-object-type.md
ResourceServer, ClientResource.Name, the current resource's nameresource.md
ResourceStatusServer, ClientWhether a resource is runningresource.md
ResourceActionServer, ClientWhat a player's game did with a resource (start, stop)resource.md
KeyServer, Client (used on the client)Keyboard keys and mouse buttonskey.md
WeaponSlotServer, ClientA player's weapon slotsweapon.md
WeaponModeServer, ClientA weapon's primary and secondary fireweapon.md
AmmoTypeServer, ClientAmmunition typesweapon.md
WeatherActServer, Client (used on the server)Weather actions: spawn and remove the tornadoweather.md
WeatherPropertyServer, Client (used on the server)Weather settings: tornado and cloudsweather.md
TornadoStateServer, Client (used on the server)States of the tornadoweather.md
VehiclePartServer, ClientDoors, hatches and other moving parts of vehiclesvehicle.md
VehiclePartStateServer, ClientOpen / closed state of a vehicle partvehicle.md
VehicleSeatServer, ClientVehicle seats and stunt positionsvehicle.md
VehicleTypeServer, Client (used on the client)Kinds of vehicles (car, boat, helicopter, ...)vehicle.md
POITypeServer, Client (used on the client)Kinds of map and world markerspoi.md
POIDisplayModeServer, Client (used on the client)Where a marker is shown (world, map, both)poi.md
MoveTypeServer, Client (used on the server)NPC movement speednpc.md
MoveStyleServer, Client (used on the server)NPC movement attitudenpc.md
LookTypeServer, Client (used on the server)Whether an NPC looks with its head or bodynpc.md
RigidObjectMotionTypeServer, ClientStatic, keyframed or dynamic rigid objectsrigid-object.md
AbilityClientThe local player's unlockable abilitiesability.md
ActionClientCharacter acts (jump, crouch, ragdoll, ...)action.md
InputActionClientPlayer input actionsaction.md
PfxLayerClientPhysics collision layers for raycastspfx-layer.md
BoneClientCharacter skeleton bonesbone.md
GameStateClientThe game's startup and loading statesgame-state.md
CharacterAttachedEffectClientVisual effects played on a charactercharacter-attached-effect.md
CameraShakeTypeClientHow a camera shake moves the cameracamera-shake-type.md
WaterBoxStyleClientHow a water box fits the terrainwater-box-style.md
ForcePulseCategoryClientKinds of explosion pushforce-pulse.md
ForcePulseTuningClientThe game's built-in explosion tuningsforce-pulse.md
RoadGraphTypeClientKinds of AI routes (road, sea, air, footpath, railway)road-graph-type.md

Where enums are used​

EnumUsed by
AclLevelclient:GetAcl(), client:HasAcl(level), client:SetAcl(flags) (PlayerHandle)
NetObjectTypeWorld.GetAllByType(type), object:GetType()
Resource, ResourceStatus, ResourceActionResources.GetAll(), resource:GetStatus(), the OnPlayerResourceAction event
KeyInput.IsKeyDown, Input.IsKeyPressed, Input.IsKeyReleased, the OnKeyDown, OnKeyUp, OnMouseDown events
WeaponSlot, WeaponMode, AmmoTypeplayer:GiveWeapon, RemoveWeapon, GetWeaponName, GetWeaponAmmo, SetWeaponAmmo, GetInventoryAmmo, SetInventoryAmmo (PlayerObjectHandle)
WeatherAct, WeatherProperty, TornadoStateWeather.SyncAct, Weather.SyncProperty (server)
VehiclePart, VehiclePartStatevehicle:GetPartState, vehicle:SetPartState (VehicleHandle), the OnVehiclePartChangedState event
VehicleSeatplayer:WarpIntoVehicle, the OnPlayerVehicleEnter and OnPlayerVehicleExit events
VehicleTypevehicle:GetVehicleType() (client)
POIType, POIDisplayModeWorld.SpawnPOI (client)
MoveType, MoveStyle, LookTypenpc:Move, npc:Follow, npc:LookAt (NPCHandle, server)
RigidObjectMotionTypeWorld.SpawnRigidObject, rigidObject:SetMotionType, RigidObject:SetMotionType
AbilityLocal.LockAbility, Local.UnlockAbility, Local.IsAbilityUnlocked
ActionLocal.PlayAction
InputActionInput.GetValue, the OnLocalPlayerInput event
PfxLayerPhysics.Raycast
Boneplayer:GetBonePosition (client)
GameStateGame.GetState()
CharacterAttachedEffectplayer:PlayAttachedEffect (client)
CameraShakeTypeCamera.SpawnShake
WaterBoxStyleWorld.SpawnWaterBox (client)
ForcePulseCategory, ForcePulseTuningWorld.SpawnForcePulse (client)
RoadGraphTypeRoadGraph.GetSamples, RoadGraph.GetEdge