How to Quit?

Guys/Gals:

Forgive my naivete, but I have a ‘quit’ button in the game I am developing and I just can’t figure out how to end the main code when someone press the button. What is the “proper” way to end the code?. Is there an equivalent of “exit” or “quit” or “end” in Lua?

Thanks,

Oleg
[import]uid: 92927 topic_id: 18960 reply_id: 318960[/import]

Hey there,

Apple actually rejects app if they use a “quit” button.

You can still quit by calling os.exit() but I’d advise against it for the above reason.

Peach :slight_smile: [import]uid: 52491 topic_id: 18960 reply_id: 73020[/import]

Peach, thanks, but how do I implement the “quit the game” button then? [import]uid: 92927 topic_id: 18960 reply_id: 73024[/import]

Normally people don’t have a quit button, that’s what I’m saying.

If you must do it (and hope Apple doesn’t reject you for it) then you could still force it doing this;

[lua]local function quitGame ()
os.exit()
end
myButton:addEventListener(“tap”, quitGame)[/lua]

Or the like.

Peach :slight_smile: [import]uid: 52491 topic_id: 18960 reply_id: 73044[/import]

Thanks !!

I will take your advice and an “easy way out” and not even have a ‘Quit Game’ button.

I wish all of the problems were that easy :slight_smile:

Thanks for your help !

Oleg
[import]uid: 92927 topic_id: 18960 reply_id: 73069[/import]

And Amazon reject my app because lack of exit button :slight_smile: [import]uid: 12704 topic_id: 18960 reply_id: 73091[/import]

Hey, @gtatarkin, seriously? If that’s the case, I’d need to make a note of this and remember to add a quit button when I port my iOS game… Is this only with apps/games for a specific device, or do all Android apps/games need quit button?

Naomi [import]uid: 67217 topic_id: 18960 reply_id: 73099[/import]

>>Is this only with apps/games for a specific device

No, definitely not. Have some games in Android Market and non of them has exit button. I’ve never seen such solution in fact :slight_smile: So it’s Amazon Appstore only and it’s some kind of misunderstanding I think :slight_smile:
Regards [import]uid: 12704 topic_id: 18960 reply_id: 73102[/import]

Ah, good. @gtatarkin, thank you for the clarification. Let’s hope Amazon Appstore gets it right very quickly. Have you brought it up with them…? Doing so would only help them, I imagine.

Naomi [import]uid: 67217 topic_id: 18960 reply_id: 73104[/import]

Avoid using quit buttons. Most devices nowadays handle app quitting internally. [import]uid: 84637 topic_id: 18960 reply_id: 73363[/import]

In most cases, quit buttons are not needed because mobile devices usually have a dedicated ‘Home’ button to take you out of the app.

But, platforms will differ, and have their own requirements which will vary from time to time.

In the case of Amazon, their flagship device, the Kindle Fire lacks any kind of hardware home button, which is probably why they require your app to have a ‘Quit’ button. [import]uid: 52430 topic_id: 18960 reply_id: 73424[/import]

Thank you so much, Jonathan, for the explanation. That makes real good sense to me. I made a note to add Quit button if/when I port to Kindle Fire.

Thanks again.
Naomi [import]uid: 67217 topic_id: 18960 reply_id: 73435[/import]