timer: add again method
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
cdbbac3c6f
commit
95eb965883
17
timer.c
17
timer.c
|
@ -100,6 +100,22 @@ luaA_timer_stop(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
luaA_timer_again(lua_State *L)
|
||||||
|
{
|
||||||
|
atimer_t *timer = luaA_checkudata(L, 1, &timer_class);
|
||||||
|
|
||||||
|
ev_timer_again(globalconf.loop, &timer->timer);
|
||||||
|
|
||||||
|
if(!timer->started)
|
||||||
|
{
|
||||||
|
luaA_object_ref(L, 1);
|
||||||
|
timer->started = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(timer, atimer_t, started, lua_pushboolean)
|
LUA_OBJECT_EXPORT_PROPERTY(timer, atimer_t, started, lua_pushboolean)
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -118,6 +134,7 @@ timer_class_setup(lua_State *L)
|
||||||
LUA_CLASS_META
|
LUA_CLASS_META
|
||||||
{ "start", luaA_timer_start },
|
{ "start", luaA_timer_start },
|
||||||
{ "stop", luaA_timer_stop },
|
{ "stop", luaA_timer_stop },
|
||||||
|
{ "again", luaA_timer_again },
|
||||||
{ "__gc", luaA_object_gc },
|
{ "__gc", luaA_object_gc },
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue