User:DonQuich: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
(Replaced content with "{{Civ5Lua/PseudoType/Header|name=TerrainID|luaEnum=TerrainTypes|xmlTable=Civ5Terrains}}")
m (testing my bot)
Line 1: Line 1:
{{Civ5Lua/PseudoType/Header|name=TerrainID|luaEnum=TerrainTypes|xmlTable=Civ5Terrains}}
''This page is a part of the [[Lua and UI Reference]].''
 
Parameters flagged with this pseudo-type are actually '''integers'''. <br/>
Pseudo-types do not exist in LUA, they only serve a documentation purpose on the wiki.<br/>
Integers labeled as 'PlotTypeID' corresponds to the constants defined in the '''PlotTypes''' LUA enumeration.<br/>
 
==PlotTypes enumeration ==
A LUA enumeration is a just a regular table. It is commonly used to store constants, the keys being the constants' names and the pairs the corresponding values.
Below are the values found in this enumeration.
 
 
{|
|-
!align="left" |Key
!
!align="left" |Value
|-
| "NO_PLOT"
|
| -1
|-
| "PLOT_MOUNTAIN"
|
| 0
|-
| "PLOT_HILLS"
|
| 1
|-
| "PLOT_LAND"
|
| 2
|-
| "PLOT_OCEAN"
|
| 3
|-
| "NUM_PLOT_TYPES"
|
| 4
|}
 
==Examples==
 
Here is how to use the LUA enumeration to retrieve the ID from the 'type'. The variable 'id' will be assigned the value 4.<pre>
local id = PlotTypes.NUM_PLOT_TYPES
local id = PlotTypes["NUM_PLOT_TYPES"]
</pre>
 
[[Category:Civ5Lua]]

Revision as of 04:12, 9 August 2012

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

Parameters flagged with this pseudo-type are actually integers.
Pseudo-types do not exist in LUA, they only serve a documentation purpose on the wiki.
Integers labeled as 'PlotTypeID' corresponds to the constants defined in the PlotTypes LUA enumeration.

PlotTypes enumeration

A LUA enumeration is a just a regular table. It is commonly used to store constants, the keys being the constants' names and the pairs the corresponding values. Below are the values found in this enumeration.


Key Value
"NO_PLOT" -1
"PLOT_MOUNTAIN" 0
"PLOT_HILLS" 1
"PLOT_LAND" 2
"PLOT_OCEAN" 3
"NUM_PLOT_TYPES" 4

Examples

Here is how to use the LUA enumeration to retrieve the ID from the 'type'. The variable 'id' will be assigned the value 4.

local id = PlotTypes.NUM_PLOT_TYPES
local id = PlotTypes["NUM_PLOT_TYPES"]