Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
roadrunner116

Terminate my Program

Question

3 answers to this question

Recommended Posts

  • 0

Sorry. Like i wrote in my other post, I was away for a week.

 

Those three way are the ways I know. I would like to Terminate the script from inside my code, but os.sleep() just does nothing.

 

This is the way I tried to close the Application.

function buttonConfTerm(name, data, playerName)
  gui.flashButton(name,0.1,2)
  os.exit()
end

The button flashes and if I put in a print() it also prints my text. So the touch-event handling seems to work

Link to post
Share on other sites
  • 0

Is this function called within an event handling function or do you handle events "manually" in your main loop?

os.exit() internally works by throwing an error. Due to that it isn't working within event listeners. (Listener errors are just written to a file and not forwarded to the main code.)

If you want it to work correctly you have to have some kind of variable like "keepRunning" that finishes your main loop when changed.

By the way: Don't forget to event.ignore before stopping your program! :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.