Name
WaitEvents -- wait until events come in (V6.0)
Synopsis
int error = WaitEvents(lua_State *L, ULONG flags, struct hwTagList *t);
Function
This function must halt the program's execution until an event comes in. The event must then be handled by your HandleEvents() implementation. WaitEvents() has to return an error code or 0 for success.

The following flags may be passed in the second parameter:

HWWEFLAGS_MODAL:
If this flag is set, then WaitEvents() has been called from a modal loop that Hollywood is currently running. A modal loop is a temporary event loop set up by functions that block the script execution until certain events happen, e.g. WaitLeftMouse() or InKeyStr(). If HWWEFLAGS_MODAL is not set, then you can be sure that Hollywood is currently running the script's main loop. This means that your WaitEvents() implementation has been called as a result of the script calling Hollywood's WaitEvent() function.

The third parameter is a tag list that can contain the following tags:

HWWETAG_AMIGASIGNALS:
This tag is always passed on Amiga systems and your WaitEvents() implementation must take it into account. The pData item of this tag is set to a ULONG pointer that contains a combination of signal bits that your WaitEvents() implementation has to take into account. Thus, on Amiga systems all WaitEvents() implementations must be based on exec.library/Wait(). You may choose to wait on additional signals but you also must take the signals that you get from Hollywood into account. Furthermore, you must write the signals that have broken your WaitEvents() implementation back to the ULONG pointer before you return from this function. This is because Hollywood needs to know which signals have triggered so that it can take appropriate action.

Please note that this function must wait for events on all displays that have currently been opened by OpenDisplay(). Additionally, it could also happen that no display is open at all and your WaitEvents() function is called. Be prepared to deal with these cases.

Also note that your WaitEvents() implementation must be capable of being woken up by ForceEventLoopIteration() when this is called from worker threads. See ForceEventLoopIteration for details.

Inputs
L
pointer to the lua_State
flags
combination of flags (see above)
t
tag list containing additional parameters (see above)
Results
error
error code or 0 for success

Show TOC