diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2013-11-18 11:12:51 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2013-11-18 11:12:51 +0100 |
commit | ab7fc5a47e5a3e5b4a51a6245bbbacff1d9d0ee4 (patch) | |
tree | 7fc4912cc5ca0cfe064f5d6e176608168bd67847 /src | |
parent | aef73939a513e67989a9ad2256f14754ebdaa28e (diff) | |
download | lanes-ab7fc5a47e5a3e5b4a51a6245bbbacff1d9d0ee4.tar.gz lanes-ab7fc5a47e5a3e5b4a51a6245bbbacff1d9d0ee4.tar.bz2 lanes-ab7fc5a47e5a3e5b4a51a6245bbbacff1d9d0ee4.zip |
Fix internal error at lane creation when the generator doesn't open any base library
Fix issue #77.
Diffstat (limited to 'src')
-rw-r--r-- | src/tools.c | 9 |
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) |