summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
77a6293)
Add Lua method to the uloop wrapper to allow reading out the remaining time of a uloop timer
Signed-off-by: Stijn Cleynhens <stijncleynhens@gmail.com>
+static int ul_timer_remaining(lua_State *L)
+{
+ struct lua_uloop_timeout *tout;
+
+ tout = lua_touserdata(L, 1);
+ lua_pushnumber(L, uloop_timeout_remaining(&tout->t));
+ return 1;
+}
+
static int ul_timer_free(lua_State *L)
{
struct lua_uloop_timeout *tout = lua_touserdata(L, 1);
static int ul_timer_free(lua_State *L)
{
struct lua_uloop_timeout *tout = lua_touserdata(L, 1);
static const luaL_Reg timer_m[] = {
{ "set", ul_timer_set },
static const luaL_Reg timer_m[] = {
{ "set", ul_timer_set },
+ { "remaining", ul_timer_remaining },
{ "cancel", ul_timer_free },
{ NULL, NULL }
};
{ "cancel", ul_timer_free },
{ NULL, NULL }
};