Lua API reference

Lua API reference

169 classes and 242 functions for Evospace 0.22.2. The same list ships as type definitions for editor completion — see Evospace/lua-api. Writing a mod for the first time: start with First mod.

Globals

  • game Game Global game instance
  • db DB Global prototype database
  • engine Engine Global engine data
  • music Music Global music manager
  • quests QuestSubsystem Global quest manager
Top-level functions and values
prelude lua
--- @type boolean|nil
LuaLogFlag = false

--- Prints info to log
--- @param message string
function print_info(message) end

--- Prints error to log but do not breaks execution
--- @param message string
function print_err(message) end

--- Prints warning to log
--- @param message string
function print_warn(message) end

--- Dimension of the running session
--- @type Dimension
dim = {}

--- This mod's table of the local player, kept in the save under the player's profile: booleans, numbers, strings, Vec3i and tables of them. nil outside a game session
--- @type table|nil
storage = {}

Prototypes

Block logic

Inventories

Accessors

Widgets

  • ui.Border Plate drawn behind one child; padding is kept inside the plate
  • ui.Button Button around one child; padding is kept inside the button
  • ui.Grid Grid of equal cells, filled row by row
  • ui.HBox Row of children laid out left to right
  • ui.Image Picture of a texture, 64 by 64 unless its width and height say otherwise
  • ui.Inventory Grid of item slots showing an inventory with the game's own slot widget
  • ui.Scroll Vertical list that scrolls instead of overflowing
  • ui.Spacer Empty space as wide and tall as its width and height
  • ui.Text Text the way the game's descriptions read: tokens such as {item:Name} become links with icons, <blue>, <yellow>, <red> and <green> tint a run
  • ui.TextBox Single line the player types into
  • ui.VBox Column of children laid out top to bottom
  • ui.Widget Base of every widget. A widget is built by calling its class with a table: named fields set its properties, the list part holds its children; ui.Text, ui.Window and ui.Button also take their main field alone, as ui.Text "...", ui.Window "..." and ui.Button(fn)
  • ui.Window Top level window with a title bar the player can drag it by; its width and height size the window, its padding is kept around the content

World actors

Instances

Namespaces

Values and engine objects

  • ActorComponent Engine actor component
  • AnimSequence Engine skeletal animation sequence
  • Class Engine class object
  • Color 8 bit per channel RGBA color
  • Engine Player facing engine and video settings
  • EventSystem Gameplay event bus
  • ExtractionData Item yielded by a resource deposit and its extraction speed
  • FQuat Rotation quaternion
  • Game Global game instance
  • GenContext Column being generated, handed to StaticStructure.generate
  • ItemData Item prototype paired with a count
  • Kto Localization key table object
  • Loc Localization data entry
  • LocData Non localized data entry
  • MapStructure Structure placed on the world map at an offset
  • Material Engine material
  • Music Background music playback control
  • Object Engine object
  • OreVeinTarget Rock an ore vein grows through and the ore block it leaves in that rock
  • PlayerController Player input and view owner
  • PropListData Structure that stores several StaticProp records (prop variations) with shared spawn chance
  • QuestSubsystem Quest and chapter progression manager
  • Railway Tracks, signals, stations and trains of a surface. Edits go out to the other peers the way the rail tools send them and land at the host's stamped tick
  • RecipeItemData Per slot recipe metadata carried next to the item and its count
  • RenderTexture Texture the game renders into, such as a block thumbnail
  • Rotator Euler rotation in degrees
  • SoundClass Engine sound class
  • StaticMesh Engine static mesh
  • TallSectorData Column of generated block cells
  • Texture Engine texture, anything a picture can be drawn from
  • Texture2D Texture loaded from an image, such as an item icon
  • Transform Location, rotation and scale of an object
  • Vec2i Integer vector 2
  • Vec3 Float vector 3
  • Vec3i Integer vector 3