diff options
Diffstat (limited to 'src/linda.cpp')
-rw-r--r-- | src/linda.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/linda.cpp b/src/linda.cpp index a7cf011..4086211 100644 --- a/src/linda.cpp +++ b/src/linda.cpp | |||
@@ -487,7 +487,6 @@ LUAG_FUNC(linda_receive) | |||
487 | * [true|lanes.cancel_error] = linda_set( linda_ud, key_num|str|bool|lightuserdata [, value [, ...]]) | 487 | * [true|lanes.cancel_error] = linda_set( linda_ud, key_num|str|bool|lightuserdata [, value [, ...]]) |
488 | * | 488 | * |
489 | * Set one or more value to Linda. | 489 | * Set one or more value to Linda. |
490 | * TODO: what do we do if we set to non-nil and limit is 0? | ||
491 | * | 490 | * |
492 | * Existing slot value is replaced, and possible queued entries removed. | 491 | * Existing slot value is replaced, and possible queued entries removed. |
493 | */ | 492 | */ |
@@ -603,7 +602,10 @@ LUAG_FUNC(linda_limit) | |||
603 | // make sure we got 3 arguments: the linda, a key and a limit | 602 | // make sure we got 3 arguments: the linda, a key and a limit |
604 | luaL_argcheck(L_, lua_gettop(L_) == 3, 2, "wrong number of arguments"); | 603 | luaL_argcheck(L_, lua_gettop(L_) == 3, 2, "wrong number of arguments"); |
605 | // make sure we got a numeric limit | 604 | // make sure we got a numeric limit |
606 | luaL_checknumber(L_, 3); | 605 | lua_Number const _limit{ luaL_checknumber(L_, 3) }; |
606 | if (_limit < 1) { | ||
607 | raise_luaL_argerror(L_, 3, "limit must be >= 1"); | ||
608 | } | ||
607 | // make sure the key is of a valid type | 609 | // make sure the key is of a valid type |
608 | check_key_types(L_, 2, 2); | 610 | check_key_types(L_, 2, 2); |
609 | 611 | ||