Lua Game Objects: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
Line 15: Line 15:
* [[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 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''

Revision as of 07:53, 14 February 2012

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 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.");