Lua Game Objects: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
(Created page with "This page contains list of known objects available. Each object has it's own page with function list and documentation. == Static Methods == Objects that have single instance. ...")
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Up: [[Lua and UI Reference]]
This page contains list of known objects available. Each object has it's own page with function list and documentation.
This page contains list of known objects available. Each object has it's own page with function list and documentation.


Line 15: Line 18:
* [[Lua Game Objects/Network|Network]] -- ''TCP/IP and HTTP methods''
* [[Lua Game Objects/Network|Network]] -- ''TCP/IP and HTTP methods''
* [[Lua Game Objects/Path|Path]] -- ''Utilities for parsing standard paths''
* [[Lua Game Objects/Path|Path]] -- ''Utilities for parsing standard paths''
* [[Lua Game Objects/PreGame|PreGame]]
* [[Lua Game Objects/PreGame|PreGame]] -- ''Used to setup a game''
* [[Lua Game Objects/Steam|Steam]] -- ''Steam overlay''
* [[Lua Game Objects/Steam|Steam]] -- ''Steam overlay''
* [[Lua Game Objects/UI|UI]] -- ''User interface''
* [[Lua Game Objects/UI|UI]] -- ''User interface''
Line 35: Line 38:
* [[Lua Game Objects/ActionSubTypes]]
* [[Lua Game Objects/ActionSubTypes]]
* [[Lua Game Objects/ActivityTypes]]
* [[Lua Game Objects/ActivityTypes]]
* [[Lua Game Objects/AICityStrategies]]
* [[Lua Game Objects/ButtonPopupTypes]]
* [[Lua Game Objects/ButtonPopupTypes]]
* [[Lua Game Objects/ButtonStates]]
* [[Lua Game Objects/ButtonStates]]

Latest revision as of 11:14, 14 February 2012

Up: Lua and UI Reference


This page contains list of known objects available. Each object has it's own page with function list and documentation.

Static Methods

Objects that have single instance.

  • DB -- Generic database routines
  • Events -- Contains various events which are routed through the engine, principally those with UI relevance
  • Game -- Methods related to the currently active CvGame instance
  • GameEvents -- Similar to Events, but related to the game rules engine, rather than the UI
  • GameInfo -- All game database is exposed over this object
  • Locale -- Methods related to Localization
  • LuaEvents -- Dynamically created events which are sent to and from arbitrary Lua states
  • Map -- Methods related to the currently active CvMap instance
  • Modding -- Modding and mod package management
  • Network -- TCP/IP and HTTP methods
  • Path -- Utilities for parsing standard paths
  • PreGame -- Used to setup a game
  • Steam -- Steam overlay
  • UI -- User interface

Lua "Classes", or Scoped Methods

Classes can have many instances. They are usually returned as function results.

Lua Enums

How to get function names for other game objects

These lists are available in ModBuddy/Help/Civ5LuaAPI.html.

Alternatively, object metatable can be obtained by calling getmetatable on non-nil object pointer. Then it is possible to iterate over all values stored in __index variable.

Example:

	local plot = Map.GetPlot(0, 0)
	print("Attributes:")
	for k, v in pairs(getmetatable(plot).__index) do print(k) end
	print("End attributes.");