Lua · Variables · Game state

globals

Time, frame, round, screen and score in one place.

FunctionWhat it does
globals.time()Seconds since the program started. Same as util.time().
globals.frametime()Seconds the last frame took. Multiply speeds by it so animation is the same at any FPS.
globals.frame()A frame counter that goes up by one every frame.
globals.map()Map name. Same as game.map().
globals.round()Round number. Same as game.round().
globals.round_time()Seconds since the round started. Same as game.time().
globals.in_match()True in a match.
globals.menu_open()True while the Adolfjon menu is open.
globals.screen()Screen size in pixels. Same as draw.screen().
globals.score()Team scores. -1 until known. The first call starts reading; values arrive within a second and refresh twice a second while you keep asking.

#globals.time

globals.time()

Seconds since the program started. Same as util.time().

Returns

number
-

#globals.frametime

globals.frametime()

Seconds the last frame took. Multiply speeds by it so animation is the same at any FPS.

Returns

number
-
Example
x = x + 120 * globals.frametime()

#globals.frame

globals.frame()

A frame counter that goes up by one every frame.

Returns

integer
-

#globals.map

globals.map()

Map name. Same as game.map().

Returns

string
-

#globals.round

globals.round()

Round number. Same as game.round().

Returns

integer
-

#globals.round_time

globals.round_time()

Seconds since the round started. Same as game.time().

Returns

number
-

#globals.in_match

globals.in_match()

True in a match.

Returns

boolean
-

#globals.menu_open

globals.menu_open()

True while the Adolfjon menu is open.

Returns

boolean
-

#globals.screen

globals.screen()

Screen size in pixels. Same as draw.screen().

Returns

number1
width
number2
height

#globals.score

globals.score()

Team scores. -1 until known. The first call starts reading; values arrive within a second and refresh twice a second while you keep asking.

Returns

integer1
T score
integer2
CT score
Example
local t, ct = globals.score()
if t >= 0 then draw.text(20, 20, t .. " : " .. ct, white) end