|
#1
|
||||
|
||||
|
well, i'm making a game, and you can quit by pressing the home button, the problem is when you press the home button twice quits and the next time the you go onto it it also quits and then you muts try again.
i think it must be that the button pressed is still in the queue and it reads it as soon as you start playing, if it is then then how do you clear queue of messages, or is there another reason for the glitch. |
|
|
|||
|
|
|
#2
|
||||
|
||||
|
I also noticed that on the simulator, but I don't think this is a real problem on the player.
Anyway, clearing the queue of messages seems to be a hard thing to do properly. Tetrajak is also searching for a good way to do it. In the meantime, I found that this works: (I got this from Cilmaviel's Paint) Code:
for i=0, 1000 do --(1000 may be a little much, how much input do you expect? 2 or 10 will also work) control.read() end |
|
#3
|
|||
|
|||
|
I think that this "glitch" is the reason why this is in the FAQ:
Q. My application works in the simulator, but not on the player, why? A. If you are using control.read() in your application you must have (at least) an os.wait(40) or os.sleep(4) in an else statement. You can go without os.wait() or os.sleep() if you use control.read(1) instead. Got another cause for this? Why not let the FAQ know in a reply on this thread? I believe what this is telling you (and Brett_val's reply does using brute force at the code level), is there needs to be a minimum 40 millisecond delay to clear the buffer. Until I saw this, I observed this "glitch" behavior in both the simulator and on the player. |
|
#4
|
||||
|
||||
|
Thanks Brett Val, your solution worked a treat.
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 02:06 PM.











Linear Mode
