Skip to content
Snippets Groups Projects
Verified Commit 0bb86feb authored by Petr Špaček's avatar Petr Špaček Committed by Vladimír Čunát
Browse files

lua: clarify event.recurrent() API

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.
parent 915a7595
Branches
Tags
1 merge request!1046lua: clarify event.recurrent() API
Pipeline #67739 passed with stages
in 14 minutes and 12 seconds
......@@ -94,7 +94,8 @@ static int event_recurrent(lua_State *L)
{
/* 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));
......
......@@ -25,7 +25,7 @@ For example, ``5 * hour`` represents five hours, or 5*60*60*100 milliseconds.
:return: event id
Similar to :func:`event.after()`, periodically execute function after ``interval`` passes.
Execute function immediatelly and then periodically after each ``interval``.
Example:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment