aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/keeper.cpp')
-rw-r--r--src/keeper.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/keeper.cpp b/src/keeper.cpp
index 2f8817c..9bde2d5 100644
--- a/src/keeper.cpp
+++ b/src/keeper.cpp
@@ -359,14 +359,14 @@ int keepercall_receive_batched(lua_State* L_)
359 359
360// ################################################################################################# 360// #################################################################################################
361 361
362// in: linda_ud key n 362// in: linda_ud key [n|nil]
363// out: true or nil 363// out: true or nil
364int keepercall_limit(lua_State* L_) 364int keepercall_limit(lua_State* L_)
365{ 365{
366 int const _limit{ static_cast<int>(lua_tointeger(L_, 3)) }; 366 int const _limit{ static_cast<int>(luaL_optinteger(L_, 3, -1)) }; // -1 if we read nil because the argument is absent
367 push_table(L_, 1); // L_: ud key n fifos 367 push_table(L_, 1); // L_: ud key n? fifos
368 lua_replace(L_, 1); // L_: fifos key n 368 lua_replace(L_, 1); // L_: fifos key n?
369 lua_pop(L_, 1); // L_: fifos key 369 lua_settop(L_, 2); // L_: fifos key
370 lua_pushvalue(L_, -1); // L_: fifos key key 370 lua_pushvalue(L_, -1); // L_: fifos key key
371 lua_rawget(L_, -3); // L_: fifos key fifo|nil 371 lua_rawget(L_, -3); // L_: fifos key fifo|nil
372 keeper_fifo* _fifo{ keeper_fifo::getPtr(L_, -1) }; 372 keeper_fifo* _fifo{ keeper_fifo::getPtr(L_, -1) };