Skip to content

Enumerations

An enumeration is a global Lua table of named integer constants. Use a named constant instead of copying a number into a script.

if unit:GetClass() == UnitClass.CAVALRY then
    LogInfo("The unit is cavalry")
end

Use the enum name index to find an exact member and value. Search before you copy a unit, technology, terrain, resource, or key name.

Available tables

Table Main use
PlayerType Human, Gaia, and bot player types.
VictoryCondition Victory condition identifiers.
ResearchState Technology availability and progress.
ReplaySpeed Replay speed identifiers.
ResourceType Resource and economy identifiers.
PlayerAttribute Player resource and population attributes.
Age Age identifiers.
ProjectileType Projectile type identifiers.
Terrain Terrain identifiers.
TileVisibility Tile visibility values.
ObjectAttribute Unit and object attributes.
UnitClass Unit class identifiers.
UnitObjectType Unit and building type identifiers.
Technology Technology identifiers.
UnitCombatStance Combat stance identifiers.
Fact Advanced fact identifiers.
ObjectData Object data identifiers.
UrgencyLevel Villager request urgency values.
BuildingPosition Building position values.
VillagerProfession Wood, food, stone, and gold professions.
PlacementDirection Placement search directions.
BuildingRequestPriority Building request priorities.
Key Windows virtual-key values.

Example

local player = GetAssignedPlayer()
if player ~= nil then
    local food = player:GetAttribute(PlayerAttribute.FOOD)
    local stance = UnitCombatStance.DEFENSIVE
end

Some tables contain more than one name for the same value. Choose one name and use it consistently.

The values match the current WololoLabs and game release. Check the enum index after you update either one.