Skip to content

queueEvent and pullEvent #2023

Closed Answered by SquidDev
SuiIntent asked this question in Q&A
Dec 9, 2024 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

This is expected behaviour, and is because the typing at the Lua prompt causes events to be consumed from the queue. What's actually happening here is:

  • os.queueEvent("foo", "bar") queues the foo event.
  • The lua program calls read, which consumes your foo event and discards it.
  • You type os.pullEvent("foo"). This a dozen key and char events, which read also consumes.
  • os.pullEvent("foo") is run. The queue is now empty, so this waits forever.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@SquidDev
Comment options

Answer selected by SuiIntent
@SuiIntent
Comment options

@SquidDev
Comment options

@SuiIntent
Comment options

@SuiIntent
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants