StdLib.Game
The game module.
@usage local Game = require('kry_stdlib/stdlib/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.
msgstringThe message to send.
conditionfun(player: LuaPlayer) -> boolean | nilOptional condition a player must satisfy.
countuintNumber 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.
sub_tablestringThe name of the table used to store the data.
indexanyOptional nested index.
keyanyThe key used to store the data.
setnil | booleanWhen true, sets
valueand returns the previously stored value.valueanyValue to store.
valueanyThe 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