Caffeine

Game state

Reference Game Last updated: Lua 5 · Dryad 0

An optional push/pop stack of named game states.

All namespaces

Namespace: caffeine.gameState

push#

Lua: caffeine.gameState.push

text
push(id)

Pushes a game state onto the stack.

ParametersTypeDescription
idstringState id.

Returns: none

Example

lua
caffeine.gameState.push('pause_menu')

pop#

Lua: caffeine.gameState.pop

text
pop() -> boolean

Pops the top game state.

Returns: boolean. The result of the stack pop (see GameStateStack::pop).

Example

lua
caffeine.gameState.pop()

top#

Lua: caffeine.gameState.top

text
top() -> string

Returns the id of the top game state.

Returns: string. Id of the top state.

Example

lua
local id = caffeine.gameState.top()

pause#

Lua: caffeine.gameState.pause

text
pause() -> boolean

Pauses the top game state.

Returns: boolean. Result of pausing the top state.

Example

lua
caffeine.gameState.pause()

resume#

Lua: caffeine.gameState.resume

text
resume() -> boolean

Resumes the top game state.

Returns: boolean. Result of resuming the top state.

Example

lua
caffeine.gameState.resume()