diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/linda.cpp | 10 | ||||
-rw-r--r-- | src/macros_and_utils.hpp | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/linda.cpp b/src/linda.cpp index a9ae61c..fa28385 100644 --- a/src/linda.cpp +++ b/src/linda.cpp | |||
@@ -1178,7 +1178,15 @@ LUAG_FUNC(linda) | |||
1178 | if (lua_isnil(L_, kIdxTop)) { | 1178 | if (lua_isnil(L_, kIdxTop)) { |
1179 | lua_pop(L_, 1); | 1179 | lua_pop(L_, 1); |
1180 | lua_pushnumber(L_, _U->lindaWakePeriod.count()); | 1180 | lua_pushnumber(L_, _U->lindaWakePeriod.count()); |
1181 | } else { | 1181 | } else if (luaG_type(L_, kIdxTop) == LuaType::STRING) { |
1182 | if (luaG_tostring(L_, kIdxTop) != "never") { | ||
1183 | luaL_argerror(L_, 1, "invalid wake_period"); | ||
1184 | } else { | ||
1185 | lua_pop(L_, 1); | ||
1186 | lua_pushnumber(L_, 0); | ||
1187 | } | ||
1188 | } | ||
1189 | else { | ||
1182 | luaL_argcheck(L_, luaL_optnumber(L_, 2, 0) > 0, 1, "wake_period must be > 0"); | 1190 | luaL_argcheck(L_, luaL_optnumber(L_, 2, 0) > 0, 1, "wake_period must be > 0"); |
1183 | } | 1191 | } |
1184 | 1192 | ||
diff --git a/src/macros_and_utils.hpp b/src/macros_and_utils.hpp index 16011f7..1aca818 100644 --- a/src/macros_and_utils.hpp +++ b/src/macros_and_utils.hpp | |||
@@ -21,6 +21,7 @@ inline void STACK_GROW(lua_State* const L_, int const n_) | |||
21 | 21 | ||
22 | // ################################################################################################# | 22 | // ################################################################################################# |
23 | 23 | ||
24 | // 1 unit of lua_Duration lasts 1 second (using default period of std::ratio<1>) | ||
24 | using lua_Duration = std::chrono::template duration<lua_Number>; | 25 | using lua_Duration = std::chrono::template duration<lua_Number>; |
25 | 26 | ||
26 | // ################################################################################################# | 27 | // ################################################################################################# |