## IupLoopStep

Runs one iteration of the message loop.

### Parameters/Return

    int IupLoopStep(void); [in C]
    int IupLoopStepWait(void); [in C]

    iup.LoopStep() -> ret: number [in Lua]
    iup.LoopStepWait() -> ret: number [in Lua]

Returns: IUP_CLOSE or IUP_DEFAULT.

### Notes

This function is useful for allowing a second message loop to be managed by the application itself. This means that messages can be intercepted and callbacks can be processed inside an application loop.

IupLoopStep returns immediately after processing any messages or if there are no messages to process. IupLoopStepWait put the system in idle until a message is processed (since 3.0).

If IUP_CLOSE is returned the IupMainLoop will not end because the return code was already processed. If you want to end IupMainLoop when IUP_CLOSE is returned by IupLoopStep then call IupExitLoop after IupLoopStep returns.

An example of how to use this function is a counter that can be stopped by the user. For such, the user has to interact with the system, which is possible by calling the function periodically.

This way, this function replaces old mechanisms implemented using the Idle callback.

Note that this function does not replace IupMainLoop.

### See Also

IupOpen, IupClose, IupMainLoop, IupExitLoop, IDLE_ACTION, Guide / System Control