I can't find a quit() function

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Julian Assange
Prole
Posts: 5
Joined: Sun Dec 19, 2010 3:39 am
Location: Obey

I can't find a quit() function

Post by Julian Assange »

What function do I need to use to allow the quit menu in my game to quit the game? I've looked through the documentation for LOVE and LUA, and tried love.quit(), love.exit() etc and haven't seen any way to do this. How do I go about this?
User avatar
Mud
Citizen
Posts: 98
Joined: Fri Nov 05, 2010 4:54 am

Re: I can't find a quit() function

Post by Mud »

It's in the native Lua library 'os':

os.quit()
User avatar
Julian Assange
Prole
Posts: 5
Joined: Sun Dec 19, 2010 3:39 am
Location: Obey

Re: I can't find a quit() function

Post by Julian Assange »

Mud wrote:It's in the native Lua library 'os':

os.quit()
I found that in Google searches, but I get a CSOD that quit is nil.

edit:
I (accidentally) found the solution. It doesn't seem to be documented on the wiki but this worked for me:

Code: Select all

love.event.push("q")
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: I can't find a quit() function

Post by Robin »

Mud wrote:It's in the native Lua library 'os':

os.quit()
Better not use functions from the os table, especially not if you want SELÖVE compatibility.
Julian Assange wrote:I (accidentally) found the solution. It doesn't seem to be documented on the wiki but this worked for me:

Code: Select all

love.event.push("q")
Yeah, that's the proper way to do it.
Help us help you: attach a .love.
User avatar
Mud
Citizen
Posts: 98
Joined: Fri Nov 05, 2010 4:54 am

Re: I can't find a quit() function

Post by Mud »

Robin wrote:Better not use functions from the os table, especially not if you want SELÖVE compatibility.
I don't care about SELÖVE compatibility. I don't really understand the point, except perhaps for use on this forum, where we often run scripts from strangers in our local binaries. I feel the same way about the sandboxed file system. *shrug*
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 11 guests