aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keeper.c')
-rw-r--r--src/keeper.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/keeper.c b/src/keeper.c
index 83ec8f3..ba4b8ed 100644
--- a/src/keeper.c
+++ b/src/keeper.c
@@ -186,28 +186,29 @@ static void push_table( lua_State* L, int idx)
186int keeper_push_linda_storage( lua_State* L, void* ptr) 186int keeper_push_linda_storage( lua_State* L, void* ptr)
187{ 187{
188 struct s_Keeper* K = keeper_acquire( ptr); 188 struct s_Keeper* K = keeper_acquire( ptr);
189 STACK_CHECK( K->L) 189 lua_State* KL = K->L;
190 lua_pushlightuserdata( K->L, fifos_key); // fifos_key 190 STACK_CHECK( KL)
191 lua_rawget( K->L, LUA_REGISTRYINDEX); // fifos 191 lua_pushlightuserdata( KL, fifos_key); // fifos_key
192 lua_pushlightuserdata( K->L, ptr); // fifos ud 192 lua_rawget( KL, LUA_REGISTRYINDEX); // fifos
193 lua_rawget( K->L, -2); // fifos storage 193 lua_pushlightuserdata( KL, ptr); // fifos ud
194 lua_remove( K->L, -2); // storage 194 lua_rawget( KL, -2); // fifos storage
195 if( !lua_istable( K->L, -1)) 195 lua_remove( KL, -2); // storage
196 if( !lua_istable( KL, -1))
196 { 197 {
197 lua_pop( K->L, 1); // 198 lua_pop( KL, 1); //
198 STACK_MID( K->L, 0); 199 STACK_MID( KL, 0);
199 return 0; 200 return 0;
200 } 201 }
201 lua_pushnil( K->L); // storage nil 202 lua_pushnil( KL); // storage nil
202 lua_newtable( L); // out 203 lua_newtable( L); // out
203 while( lua_next( K->L, -2)) // storage key fifo 204 while( lua_next( KL, -2)) // storage key fifo
204 { 205 {
205 keeper_fifo* fifo = prepare_fifo_access( K->L, -1); // storage key fifo 206 keeper_fifo* fifo = prepare_fifo_access( KL, -1); // storage key fifo
206 lua_pushvalue( K->L, -2); // storage key fifo key 207 lua_pushvalue( KL, -2); // storage key fifo key
207 luaG_inter_move( K->L, L, 1); // storage key fifo // out key 208 luaG_inter_move( KL, L, 1); // storage key fifo // out key
208 STACK_CHECK( L) 209 STACK_CHECK( L)
209 lua_newtable( L); // out key keyout 210 lua_newtable( L); // out key keyout
210 luaG_inter_move( K->L, L, 1); // storage key // out key keyout fifo 211 luaG_inter_move( KL, L, 1); // storage key // out key keyout fifo
211 lua_pushinteger( L, fifo->first); // out key keyout fifo first 212 lua_pushinteger( L, fifo->first); // out key keyout fifo first
212 lua_setfield( L, -3, "first"); // out key keyout fifo 213 lua_setfield( L, -3, "first"); // out key keyout fifo
213 lua_pushinteger( L, fifo->count); // out key keyout fifo count 214 lua_pushinteger( L, fifo->count); // out key keyout fifo count
@@ -218,8 +219,8 @@ int keeper_push_linda_storage( lua_State* L, void* ptr)
218 lua_rawset( L, -3); // out 219 lua_rawset( L, -3); // out
219 STACK_END( L, 0) 220 STACK_END( L, 0)
220 } 221 }
221 lua_pop( K->L, 1); // 222 lua_pop( KL, 1); //
222 STACK_END( K->L, 0) 223 STACK_END( KL, 0)
223 keeper_release( K); 224 keeper_release( K);
224 return 1; 225 return 1;
225} 226}