Lua Reference
From Civilization V Wiki
This section lists the Lua files contained in the core Assets directory. Each section is named for the folder that contains the files and subfolders. Where it makes sense, each directory has an overall description of the types of files it contains. Each file has a brief description if necessary and links to its own page for more details. Most file lists are alphabetized, but some are grouped by related purpose.
This page does not describe the classes and functions exposed to Lua by the SDK. Perhaps we need three pages: SDK (Game Objects), Utilities, and UI.
For the list of game objects available, see Lua Game Objects.
For the list of events, see Lua Game Events.
Contents |
Automation
Provides examples of using the Automation Lua object to run autoplay games.
Each module has the same structure. SetupGame() sets up the game and number of turns, and OnEndFrameEvent() dumps out profiling or other stats after each frame and exits the game when the setup turn limit is reached. These are followed by top-level code that sets the event callback, calls SetupGame(), and fires a StartGame event.
Gameplay
Miscellaneous utilities and map generator modules.
- FLuaVector.lua
Functions to create tables containing two to four coordinates named x, y, z, and w: Vector2(x, y), Vector3(x, y, z), Vector4(x, y, z, w). Color(r, g, b, a) is an alias for Vector4(). Also VecAdd(v1, v2) and VecSubtract(v1, v2). - GameplayUtilities.lua
GameplayUtilities.GetLocalizedLeaderTitle(Player) returns the formal name and title of a leader. - ModBrowserUtilities.lua
Functions for handling mod download state and providing localized messages in the mod browser.
Map Generator Core
These are used by the map scripts in Maps.
- AssignStartingPlots.lua
Assigns locations for all non-terrain elements on the map: resources, natural wonders, city states and players. - FeatureGenerator.lua
- MapGenerator.lua
Base funtion that triggers all other subsystems and provides stubs to be overridden by specific map scripts. - MapmakerUtilities.lua
- TerrainGenerator.lua
- WorldBuilderRandomItems.lua
Landmass Type Generators
These are used by the map scripts in Maps.
- ContinentsWorld.lua
- FourContinentsWorld.lua
- FractalWorld.lua
- HintedWorld.lua
- MultilayeredFractal.lua
- PangaeaWorld.lua
Maps
Contains the built-in map scripts and some custom maps. See [#Gameplay_/_Lua] for the map generator core and scripts related to generating maps.
- Archipelago.lua
- Continents.lua
- Four_Corners.lua
- Fractal.lua
- Great_Plains.lua
- Highlands.lua
- Ice_Age.lua
- InlandSea.lua
- Lakes.lua
- North_vs_South.lua
- Oval.lua
- Pangaea.lua
- SmallContinents.lua
- Terra.lua
- TinyIslands.lua
- West_vs_East.lua
Tutorial
Controls the in-game tutorial.
UI
Builds the entire game user interface including screens, overlays, menus, popups, hover text, etc.
This section should probably be moved to its own page as it will get very, very large and is somewhat unrelated to the above.
- IconSupport.lua
Functions for looking up civilization icons. - InstanceManager.lua
Class to build and track "control" instances--both those in-use and available because they were released--and provide access to them to other modules. Are these UI controls specifically, screens, something else? Uses ContextPtr.BuildInstance() and ContextPtr.BuildInstanceForControl() to build instances. - SupportFunctions.lua
TruncateString() sets a control's label by truncating its current label or an input string to a specified maximum length and adding ellipses if it was shortened.
Three folders contain a single Lua and XML file pair each.
FrontEnd
Contains the screens and menus that exist outside of an active game: main menu, game settings, multiplayer lobby, mod browsing, etc.
- Credits.lua
- ExitConfirm.lua
- FrontEnd.lua
- FrontEndPopup.lua
- GridExamples.lua
- LegalScreen.lua
- LoadMenu.lua
- LoadScreen.lua
- LoadTutorial.lua
- MainMenu.lua
- OtherMenu.lua
- PreGameScreen.lua
- SinglePlayer.lua
- ToolTips.lua
- UITestMenu.lua
- WaitingForPlayers.lua
- WorldPicker.lua
GameSetup
- AdvancedSetup.lua
- GameSetupScreen.lua
- SelectCivilization.lua
- SelectDifficulty.lua
- SelectGameSpeed.lua
- SelectMapSize.lua
- SelectMapType.lua
- SetCivNames.lua
- UniqueBonuses.lua
Modding
- CustomMod.lua
- DownloadingPanel.lua
- EULA.lua
- InstalledPanel.lua
- ModsBrowser.lua
- ModsError.lua
- ModsMenu.lua
- ModsReportOffense.lua
- ModsScreenShot.lua
- ModsSinglePlayer.lua
- OnlinePanel.lua
Multiplayer
InGame
Contains the screens, menus, and popups for the entire in-game interface: main screen, city screen, advisors, tech tree, strategy layer, diplomacy, trading, etc.
- Bombardment.lua
- CityBannerManager.lua
- CityList.lua
- ColorKey.lua
- DebugMenu.lua
- DebugMode.lua
- DiploList.lua
- FluidFOW.lua
- GenericWorldAnchor.lua
- GraphicsPanel.lua
- HexDebugTextPanel.lua
- InfoCorner.lua
- InfoTooltipInclude.lua
- InGame.lua
- NewTurn.lua
- PlotHelpManager.lua
- PlotMouseoverInclude.lua
- ResourceIconManager.lua
- ResourceTooltipGenerator.lua
- TaskList.lua
- TechPanel.lua
- TechPopup.lua
- TerrainPanel.lua
- TopPanel.lua
- Tutorial.lua
- UnitFlagManager.lua
- UnitList.lua
- UnitMemberOverlay.lua
- YieldIconManager.lua
CityView
LeaderHead
Menus
Popups
- AdvisorCounselPopup.lua
- AdvisorInfoPopup.lua
- AdvisorModal.lua
- BarbarianCampPopup.lua
- CityStateDiploPopup.lua
- CityStateGreetingPopup.lua
- Demographics.lua
- DiploCurrentDeals.lua
- DiploGlobalRelationships.lua
- DiploOverview.lua
- DiploRelationships.lua
- DiploVotePopup.lua
- EconomicOverview.lua
- EndGameMenu.lua
- GenericPopup.lua
- GoldenAgePopup.lua
- GoodyHutPopup.lua
- GreatPersonRewardPopup.lua
- HallOfFame.lua
- MilitaryOverview.lua
- NaturalWonderPopup.lua
- NewEraPopup.lua
- NotificationLogPopup.lua
- ProductionPopup.lua
- Ranking.lua
- SetCityName.lua
- SetUnitName.lua
- SocialPolicyPopup.lua
- TechAwardPopup.lua
- VictoryProgress.lua
- VoteResultsPopup.lua
- WhosWinningPopup.lua
- WonderPopup.lua
PopupsGeneric
- AnnexCityPopup.lua
- BarbarianRansomPopup.lua
- CityPlotManagementPopup.lua
- ConfirmCityTaskPopup.lua
- ConfirmCommandPopup.lua
- ConfirmGiftPopup.lua
- ConfirmImprovementRebuildPopup.lua
- ConfirmPolicyBranchPopup.lua
- DeclareWarMovePopup.lua
- DeclareWarRangeStrikePopup.lua
- GreatPersonPopup.lua
- LiberateMinorPopup.lua
- MinorCivEnterTerritoryPopup.lua
- MinorCivGoldPopup.lua
- PuppetCityPopup.lua
- ReturnCivilianPopup.lua

