Lua Game Objects

From Civilization Modding Wiki
Jump to navigationJump to search

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