- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
welbre
-
Content Count
2 -
Joined
-
Last visited
Posts posted by welbre
-
-
You are creating a loop without any yielding, so, the OpenOS create a exemption to break the loop and close you program.
To solve this, just use os.sleep(time), where time is the time that the program will wait in the while loop.
Other way is use the event api, using local event = require"event", and using event.pull("key_down"), see the event api documentation to understand tha api, the event.pull function block the loop until the "key_down" event happen.
The 2 ways do the same thing, create a yielding in program thread, so the OpenOS khows that the program isn't in a no end loop.
thread not detaching
in Programming
Posted
You need to yield the thread, use os.sleep function in while loop block.