aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-04-18 17:53:27 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2025-04-18 17:53:27 +0200
commit4c5d11823802175cfaf083a6fcd20a3006b27d51 (patch)
tree95ecb36d71620d5f61f5c06f3f022a3667181606 /src
parent022e40cc71beda874d0bad2cec227e472d5dd4af (diff)
downloadlanes-4c5d11823802175cfaf083a6fcd20a3006b27d51.tar.gz
lanes-4c5d11823802175cfaf083a6fcd20a3006b27d51.tar.bz2
lanes-4c5d11823802175cfaf083a6fcd20a3006b27d51.zip
A unit test for linda wake_period
Diffstat (limited to '')
-rw-r--r--src/linda.cpp10
-rw-r--r--src/macros_and_utils.hpp1
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>)
24using lua_Duration = std::chrono::template duration<lua_Number>; 25using lua_Duration = std::chrono::template duration<lua_Number>;
25 26
26// ################################################################################################# 27// #################################################################################################