Skip to content

QuitGame

Leaves the server and closes the game - a menu’s Exit.

Works only in answer to a key: called from OnKey while the script holds the keyboard (SetKeyboardCapture), for a key the player pressed. Anywhere else - a timer, an event from the server, a script that has not taken the keyboard - it does nothing, so a script can offer the player a way out but never close their game on its own. The server sees an ordinary disconnect.

QuitGame()

nothing

function OnKey(key, pressed)
if pressed and key == "escape" and loginBoxShown then
QuitGame() -- the login box's Exit
end
end

SetKeyboardCapture · OnKey · the The game’s UI for a script group of the index