Getters functions

GetDisplayResolution()

Returns the width and height (respectively) of the game window in pixels.

Definition

GetDisplayResolution() -> float, float

Usage example

init.lua
width, height = GetDisplayResolution()
print(width, height)
<console>
> 1920 1080

GetMod()

Returns the return value of the mod with the given name.

If you don't return anything in your init.lua file, this function will return nil. This will often look like return MyMod:new() at the end of your file. See the Lua documentation for info about how classes can be implemented in Lua.

Definition

GetMod(modName: string) -> object

Usage example

init.lua
mod = GetMod('MyMod')
returns
-- any data returned by the mod

GetSingleton()

Returns the singleton for the given type name if it exists, otherwisenil.

A singleton is the sole instance of a type, often used for global operations.

Definition

GetSingleton(singletonTypeName: string) -> SingletonReference | nil

Usage example

init.lua
gameTime = GetSingleton("gameTimeSystem")

-- get time
gameTime:GetGameTime()

-- set time
gameTime:SetGameTimeByHMS(12, 0, 0) -- 12h0m0s
returns
GameTime[ seconds:734466 ]

GetVersion()

Returns the current CET build's commit hash.

Definition

GetVersion() -> string

Usage example

init.lua
version = GetVersion()

print(version)
<console>
> v1.27.1

ModArchiveExists()

Returns whether the specified .archive file is present in the archive/pc/mod folder

Definition

ModArchiveExists(archiveName: string) -> bool

Usage example

init.lua
print(ModArchiveExists('myModFiles.archive'))
<console>
> true

Last updated