aboutsummaryrefslogtreecommitdiff
path: root/src/linda.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linda.c')
-rw-r--r--src/linda.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/linda.c b/src/linda.c
index 2128520..d92f5f2 100644
--- a/src/linda.c
+++ b/src/linda.c
@@ -90,12 +90,16 @@ LUAG_FUNC( linda_protected_call)
90 Keeper* K = keeper_acquire( linda->U->keepers, LINDA_KEEPER_HASHSEED(linda)); 90 Keeper* K = keeper_acquire( linda->U->keepers, LINDA_KEEPER_HASHSEED(linda));
91 lua_State* KL = K ? K->L : NULL; // need to do this for 'STACK_CHECK' 91 lua_State* KL = K ? K->L : NULL; // need to do this for 'STACK_CHECK'
92 if( KL == NULL) return 0; 92 if( KL == NULL) return 0;
93 // if we didn't do anything wrong, the keeper stack should be clean
94 ASSERT_L(lua_gettop(KL) == 0);
93 95
94 // retrieve the actual function to be called and move it before the arguments 96 // retrieve the actual function to be called and move it before the arguments
95 lua_pushvalue( L, lua_upvalueindex( 1)); 97 lua_pushvalue( L, lua_upvalueindex( 1));
96 lua_insert( L, 1); 98 lua_insert( L, 1);
97 // do a protected call 99 // do a protected call
98 rc = lua_pcall( L, lua_gettop( L) - 1, LUA_MULTRET, 0); 100 rc = lua_pcall( L, lua_gettop( L) - 1, LUA_MULTRET, 0);
101 // whatever happens, the keeper state stack must be empty when we are done
102 lua_settop(KL, 0);
99 103
100 // release the keeper 104 // release the keeper
101 keeper_release( K); 105 keeper_release( K);