diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2012-12-03 17:54:05 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2012-12-03 17:54:05 +0100 |
commit | da08c6957da54626a905185c201be342a230e76e (patch) | |
tree | 56e06892b85ebaf465d4ecec1f51c38d0f8a34f8 /src/lanes.c | |
parent | 68088c8c7636ddcd5bd64ab7edcf17ce2d4eebc8 (diff) | |
download | lanes-da08c6957da54626a905185c201be342a230e76e.tar.gz lanes-da08c6957da54626a905185c201be342a230e76e.tar.bz2 lanes-da08c6957da54626a905185c201be342a230e76e.zip |
fix issue #40
linda:send() and linda:receive() no longer trigger string->number autocoercion when checking for the optional timeout argument: a string is always a linda slot, even if coercible.
Diffstat (limited to 'src/lanes.c')
-rw-r--r-- | src/lanes.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lanes.c b/src/lanes.c index 6c044d1..bab5244 100644 --- a/src/lanes.c +++ b/src/lanes.c | |||
@@ -279,9 +279,9 @@ LUAG_FUNC( linda_send) | |||
279 | 279 | ||
280 | luaL_argcheck( L, linda, 1, "expected a linda object!"); | 280 | luaL_argcheck( L, linda, 1, "expected a linda object!"); |
281 | 281 | ||
282 | if( lua_isnumber(L, 2)) | 282 | if( lua_type( L, 2) == LUA_TNUMBER) // we don't want to use lua_isnumber() because of autocoercion |
283 | { | 283 | { |
284 | timeout= SIGNAL_TIMEOUT_PREPARE( lua_tonumber(L,2) ); | 284 | timeout = SIGNAL_TIMEOUT_PREPARE( lua_tonumber( L,2)); |
285 | ++ key_i; | 285 | ++ key_i; |
286 | } | 286 | } |
287 | else if( lua_isnil( L, 2)) // alternate explicit "no timeout" by passing nil before the key | 287 | else if( lua_isnil( L, 2)) // alternate explicit "no timeout" by passing nil before the key |
@@ -418,7 +418,7 @@ LUAG_FUNC( linda_receive) | |||
418 | 418 | ||
419 | luaL_argcheck( L, linda, 1, "expected a linda object!"); | 419 | luaL_argcheck( L, linda, 1, "expected a linda object!"); |
420 | 420 | ||
421 | if( lua_isnumber( L, 2)) | 421 | if( lua_type( L, 2) == LUA_TNUMBER) // we don't want to use lua_isnumber() because of autocoercion |
422 | { | 422 | { |
423 | timeout = SIGNAL_TIMEOUT_PREPARE( lua_tonumber( L, 2)); | 423 | timeout = SIGNAL_TIMEOUT_PREPARE( lua_tonumber( L, 2)); |
424 | ++ key_i; | 424 | ++ key_i; |