It was rather confusing:
- event.after(0, ...) executed function immediatelly
- event.recurrent(0, ...) executed function immediatelly (seemingly worked)
but stoped after the first execution, i.e. no recurrence took place.
{
/* Check parameters */
int n = lua_gettop(L);
- if (n < 2 || !lua_isnumber(L, 1) || !lua_isfunction(L, 2))
+ if (n < 2 || !lua_isnumber(L, 1) || lua_tointeger(L, 1) == 0
+ || !lua_isfunction(L, 2))
lua_error_p(L, "expected 'recurrent(number interval, function)'");
return event_sched(L, 0, lua_tointeger(L, 1));
:return: event id
- Similar to :func:`event.after()`, periodically execute function after ``interval`` passes.
+ Execute function immediatelly and then periodically after each ``interval``.
Example: