Difference between revisions of "love.quit"

m (Function: Better name for return value.)
(definition should contain reference to the default love.run)
 
Line 1: Line 1:
 
{{newin|[[0.7.0]]|070|type=callback}}
 
{{newin|[[0.7.0]]|070|type=callback}}
Callback function triggered when the game is closed.
+
Callback function triggered by the [[love.run#The default function for 11.0, used if you don't supply your own.|default love.run]] when the game is closed.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Latest revision as of 15:05, 26 December 2024

Available since LÖVE 0.7.0
This callback is not supported in earlier versions.

Callback function triggered by the default love.run when the game is closed.

Function

Synopsis

abort = love.quit( )

Arguments

None.

Returns

boolean abort
Abort quitting. If true, do not close the game.

Example

This example shows how the return value of love.quit can be used to stop the closing of the game.

local readyToQuit = false

function love.quit()
	if not readyToQuit then
		print("We are not ready to quit yet!")
		readyToQuit = true
		return true
	else
		print("Thanks for playing. Please play again soon!")
		return false
	end
end

See Also


Other Languages