mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-13 06:37:51 +00:00
Simplify register_lsyncd(), too
This commit is contained in:
parent
702f6d3d4e
commit
68982e6e5b
20
lsyncd.c
20
lsyncd.c
@ -1373,26 +1373,24 @@ register_lsyncd(lua_State *L)
|
||||
|
||||
// creates the metatable for jiffies userdata
|
||||
luaL_newmetatable(L, "Lsyncd.jiffies");
|
||||
lua_pushstring(L, "__add");
|
||||
int mt = lua_gettop(L);
|
||||
|
||||
lua_pushcfunction(L, l_jiffies_add);
|
||||
lua_settable(L, -3);
|
||||
lua_setfield(L, mt, "__add");
|
||||
|
||||
lua_pushstring(L, "__sub");
|
||||
lua_pushcfunction(L, l_jiffies_sub);
|
||||
lua_settable(L, -3);
|
||||
lua_setfield(L, mt, "__sub");
|
||||
|
||||
lua_pushstring(L, "__lt");
|
||||
lua_pushcfunction(L, l_jiffies_lt);
|
||||
lua_settable(L, -3);
|
||||
lua_setfield(L, mt, "__lt");
|
||||
|
||||
lua_pushstring(L, "__le");
|
||||
lua_pushcfunction(L, l_jiffies_le);
|
||||
lua_settable(L, -3);
|
||||
lua_setfield(L, mt, "__le");
|
||||
|
||||
lua_pushstring(L, "__eq");
|
||||
lua_pushcfunction(L, l_jiffies_eq);
|
||||
lua_settable(L, -3);
|
||||
lua_pop(L, 1);
|
||||
lua_setfield(L, mt, "__eq");
|
||||
|
||||
lua_pop(L, 1); // pop(mt)
|
||||
|
||||
#ifdef LSYNCD_WITH_INOTIFY
|
||||
lua_getglobal(L, "lsyncd");
|
||||
|
Loading…
Reference in New Issue
Block a user