diff options
author | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-02-27 18:32:00 +0100 |
---|---|---|
committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-02-27 18:32:00 +0100 |
commit | 437759ddf0ce7e6dc5ed4944e033ef04674de430 (patch) | |
tree | fc4a00832167b6f2735bdd3749965d85d00ab068 /src/keeper.c | |
parent | cf2d7438f0e6e56a7c5dd78dfde7639eac571d98 (diff) | |
download | lanes-437759ddf0ce7e6dc5ed4944e033ef04674de430.tar.gz lanes-437759ddf0ce7e6dc5ed4944e033ef04674de430.tar.bz2 lanes-437759ddf0ce7e6dc5ed4944e033ef04674de430.zip |
linda:send() improvements
* Bumped version to 3.9.3
* new exposed variable linda.null that exposes the internal NIL_SENTINEL
marker
* linda:send() interprets send key linda.null as authorization to
silently send a single nil when not provided with anything to send
(useful when sending results of a function that can return nothing)
Diffstat (limited to 'src/keeper.c')
-rw-r--r-- | src/keeper.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/keeper.c b/src/keeper.c index 9e5317b..7362ca6 100644 --- a/src/keeper.c +++ b/src/keeper.c | |||
@@ -756,23 +756,19 @@ void keeper_release( struct s_Keeper* K) | |||
756 | void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, enum eLookupMode mode_) | 756 | void keeper_toggle_nil_sentinels( lua_State* L, int val_i_, enum eLookupMode mode_) |
757 | { | 757 | { |
758 | int i, n = lua_gettop( L); | 758 | int i, n = lua_gettop( L); |
759 | /* We could use an empty table in 'keeper.lua' as the sentinel, but maybe | ||
760 | * checking for a lightuserdata is faster. (any unique value will do -> take the address of some global symbol of ours) | ||
761 | */ | ||
762 | void* nil_sentinel = (void*) keeper_toggle_nil_sentinels; | ||
763 | for( i = val_i_; i <= n; ++ i) | 759 | for( i = val_i_; i <= n; ++ i) |
764 | { | 760 | { |
765 | if( mode_ == eLM_ToKeeper) | 761 | if( mode_ == eLM_ToKeeper) |
766 | { | 762 | { |
767 | if( lua_isnil( L, i)) | 763 | if( lua_isnil( L, i)) |
768 | { | 764 | { |
769 | lua_pushlightuserdata( L, nil_sentinel); | 765 | lua_pushlightuserdata( L, NIL_SENTINEL); |
770 | lua_replace( L, i); | 766 | lua_replace( L, i); |
771 | } | 767 | } |
772 | } | 768 | } |
773 | else | 769 | else |
774 | { | 770 | { |
775 | if( lua_touserdata( L, i) == nil_sentinel) | 771 | if( lua_touserdata( L, i) == NIL_SENTINEL) |
776 | { | 772 | { |
777 | lua_pushnil( L); | 773 | lua_pushnil( L); |
778 | lua_replace( L, i); | 774 | lua_replace( L, i); |