Kryzeth Standard Library

game

Methods8

function Game.get_player(mixed: PlayerIdentification | table) -> player LuaPlayer | nil

Returns a valid player from a player identification or event containing player_index.

function Game.get_force(mixed: string | LuaForce | table) -> force LuaForce | nil

Returns a valid force from a force name, LuaForce, or object/event containing force.

function Game.get_surface(mixed: SurfaceIdentification | table) -> surface LuaSurface | nil

Returns a valid surface from a surface identification or object/event containing surface.

function Game.print_all(msg: string, condition: fun(player: LuaPlayer) -> boolean | nil) -> count uint

Messages all players currently connected to the game. Offline players are not counted as having received the message. If no players exist, the message is stored in storage._print_queue.

Parameters
msgstring

The message to send.

conditionfun(player: LuaPlayer) -> boolean | nil

Optional condition a player must satisfy.

Returns
countuint

Number of players who received the message.

function Game.get_or_set_data(sub_table: string, index: any, key: any, set: nil | boolean, value: any) -> value any

Gets or sets data in the storage variable.

Parameters
sub_tablestring

The name of the table used to store the data.

indexany

Optional nested index.

keyany

The key used to store the data.

setnil | boolean

When true, sets value and returns the previously stored value.

valueany

Value to store.

Returns
valueany

The stored value or previous value.

function Game.write_mods() -> nil

Writes the currently active mods to Mods.lua.

function Game.write_statistics() -> nil

Writes pollution and production statistics for all surfaces and forces.

function Game.write_surfaces() -> nil

Writes the map generation settings for every surface.

Fields2

Game.__class: string = "Game"
Game.__index : StdLib.Core