summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-05-24 13:13:42 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-05-24 13:13:42 +0000
commit35b85950a7e144da1c1390e6cd5dcae5adea61bc (patch)
treedea46d8d424754de35ab145f61d99ed4bdc7a20f
parent7202305164fc8d8c1d576755666f9056f31d40f9 (diff)
MirLua: fix Every function in m_schedule
git-svn-id: http://svn.miranda-ng.org/main/trunk@16868 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/MirLua/src/m_schedule.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/MirLua/src/m_schedule.cpp b/plugins/MirLua/src/m_schedule.cpp
index 3ee8b70663..c501de84a9 100644
--- a/plugins/MirLua/src/m_schedule.cpp
+++ b/plugins/MirLua/src/m_schedule.cpp
@@ -525,16 +525,6 @@ static int fluent_Sunday(lua_State *L)
return 1;
}
-static const luaL_Reg scheduleEvery2Api[] =
-{
- { "Seconds", fluent_Seconds },
- { "Minutes", fluent_Minutes },
- { "Hours", fluent_Hours },
- { "Days", fluent_Days },
-
- { NULL, NULL }
-};
-
static const luaL_Reg scheduleEvery1Api[] =
{
{ "Second", fluent_Second },
@@ -553,6 +543,16 @@ static const luaL_Reg scheduleEvery1Api[] =
{ NULL, NULL }
};
+static const luaL_Reg scheduleEvery2Api[] =
+{
+ { "Seconds", fluent_Seconds },
+ { "Minutes", fluent_Minutes },
+ { "Hours", fluent_Hours },
+ { "Days", fluent_Days },
+
+ { NULL, NULL }
+};
+
/***********************************************/
static int schedule_At(lua_State *L)
@@ -579,6 +579,10 @@ static int schedule_Every(lua_State *L)
{
int interval = luaL_optinteger(L, 1, 0);
+ const luaL_Reg *funcs = lua_isnone(L, 1)
+ ? scheduleEvery1Api
+ : scheduleEvery2Api;
+
lua_newtable(L);
lua_pushinteger(L, interval);
lua_setfield(L, -2, "Interval");
@@ -587,9 +591,6 @@ static int schedule_Every(lua_State *L)
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
lua_pushvalue(L, -2);
- const luaL_Reg *funcs = lua_isnoneornil(L, 1)
- ? scheduleEvery1Api
- : scheduleEvery2Api;
luaL_setfuncs(L, funcs, 1);
lua_setmetatable(L, -2);