PolicyBranchType (Civ5 Type)

From Civilization Modding Wiki
Jump to: navigation, search

This page is a part of the Lua and UI Reference (Civ5).


ID.png The PolicyBranchType pseudo-type is actually a regular integer. Pseudo-types do not exist in Lua, they only serve a documentation purpose on the wiki!
  • DB.png Integers labeled as PolicyBranchType corresponds to the ID column of the PolicyBranchTypes XML table.
  • Lua.png The standard (unmodded) values in the ID and Type columns are also stored in the PolicyBranchTypes Lua enumeration.


Lua: the PolicyBranchTypes enumeration

Firaxis provides a Lua enumeration named PolicyBranchTypes. This is just a regular global table. Its keys are the constants' names and the pairs the corresponding values.

  • This specific enumeration contains data from the PolicyBranchTypes data table.
  • They are stored as key/value pairs: the keys are the strings from the Type column and the values are the integers from the ID column.

Radioactive.png Be careful: this enumeration do not reflect the changes, additions and deletions made by mods. As a result it is advised to rely on GameInfo instead.


Below are the values found in this enumeration.

Key Value
"NO_POLICY_BRANCH_TYPE" -1


XML: the PolicyBranchTypes table

Here are the ID and Type columns found in this table.

ID Type
0 POLICY_BRANCH_TRADITION
1 POLICY_BRANCH_LIBERTY
2 POLICY_BRANCH_HONOR
3 POLICY_BRANCH_PIETY
4 POLICY_BRANCH_PATRONAGE
5 POLICY_BRANCH_COMMERCE
6 POLICY_BRANCH_RATIONALISM
7 POLICY_BRANCH_FREEDOM
8 POLICY_BRANCH_ORDER
9 POLICY_BRANCH_AUTOCRACY


Examples

Here is how to use the LUA enumeration to retrieve the ID from the type. Those examples will return and assign the integer value -1.

local id = PolicyBranchTypes.NO_POLICY_BRANCH_TYPE
local id = PolicyBranchTypes["NO_POLICY_BRANCH_TYPE"]


Used by

PolicyBranchType Player:GetDominantPolicyBranchForTitle()
bool Player:IsPolicyBranchBlocked(PolicyBranchType policyBranchIndex)
bool Player:IsPolicyBranchFinished(PolicyBranchType arg0)
int Player:IsPolicyBranchUnlocked(PolicyBranchType policyBranchIndex)
Player:SetPolicyBranchUnlocked(PolicyBranchType arg0, bool arg1)
TextButton:RegisterCallback(MouseType OnSearchTextEnter, (void func(PolicyBranchType policyBranchIndex, UnitType y, Button button)) OnClose = nil)
PolicyBranchType UIManager.SetUICursor(PolicyBranchType oldCursor)



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.