info = CheckEvent()
CheckEvent()
will remove it from the queue and run its callback function. If there is no event
in the queue, CheckEvent()
will return immediately.
CheckEvent()
returns a table that contains information about whether or not it
has executed a callback. The following fields will be initialized in that table:
Action:
OnMouseDown
). If CheckEvent()
returns without having ran a callback,
this field will be set to an empty string.
ID:
ID
can also be zero in case an event was caused that
has no ID associated.
Triggered:
True
if CheckEvent()
has executed a callback.
NResults:
Results:
NResults
is greater than 0, this table will contain all values that
the user callback returned. Otherwise this table will not be present
at all. You can easily use this table to pass additional information from
your callbacks back to the main scope of the program.
CheckEvent()
is similar to the popular WaitEvent() command with the
difference that WaitEvent() blocks the script execution until an event
arrives whereas CheckEvent()
immediately exits if there is no event.
By using this command you can do something while waiting for an event which
would not be possible with WaitEvent().
Note that CheckEvent()
only handles a single event from the event queue. If
you'd like to handle all events that are currently in the event queue, you
have to use CheckEvents() instead. See CheckEvents for details.
Please note that generally you should use CheckEvent()
only if you really need
it. Using WaitEvent() is normally a much better idea than CheckEvent()
.