aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/tools.c b/src/tools.c
index 684c776..754605b 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -579,13 +579,16 @@ lua_State* luaG_newstate( lua_State* _from, int const _on_state_create, char con
579 (void) luaL_error( _from, "'lua_newstate()' failed; out of memory"); 579 (void) luaL_error( _from, "'lua_newstate()' failed; out of memory");
580 } 580 }
581 581
582 // we'll need this everytime we transfer some C function from/to this state
583 lua_newtable( L);
584 lua_setfield( L, LUA_REGISTRYINDEX, LOOKUP_REGKEY);
585
582 // neither libs (not even 'base') nor special init func: we are done 586 // neither libs (not even 'base') nor special init func: we are done
583 if( libs == NULL && _on_state_create <= 0) 587 if( libs == NULL && _on_state_create <= 0)
584 { 588 {
585 DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_newstate(NULL)\n" INDENT_END)); 589 DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_newstate(NULL)\n" INDENT_END));
586 return L; 590 return L;
587 } 591 }
588 // from this point, we are not creating a keeper state (because libs == NULL when we init keepers)
589 592
590 DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_newstate()\n" INDENT_END)); 593 DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "luaG_newstate()\n" INDENT_END));
591 DEBUGSPEW_CODE( ++ debugspew_indent_depth); 594 DEBUGSPEW_CODE( ++ debugspew_indent_depth);
@@ -595,10 +598,6 @@ lua_State* luaG_newstate( lua_State* _from, int const _on_state_create, char con
595 // 'lua.c' stops GC during initialization so perhaps its a good idea. :) 598 // 'lua.c' stops GC during initialization so perhaps its a good idea. :)
596 lua_gc( L, LUA_GCSTOP, 0); 599 lua_gc( L, LUA_GCSTOP, 0);
597 600
598 // we'll need this everytime we transfer some C function from/to this state
599 lua_newtable( L);
600 lua_setfield( L, LUA_REGISTRYINDEX, LOOKUP_REGKEY);
601
602 // Anything causes 'base' to be taken in 601 // Anything causes 'base' to be taken in
603 // 602 //
604 if( libs != NULL) 603 if( libs != NULL)