diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2013-02-01 10:55:49 +0100 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2013-02-01 10:55:49 +0100 |
commit | 5a5fb7c8b359582bb684c1389598a83c726eb73f (patch) | |
tree | 8b21d5150822312949317285d9f7e88f86de247b /src/tools.c | |
parent | b657f38535c3c27a848353ef853d6667d6acc917 (diff) | |
download | lanes-5a5fb7c8b359582bb684c1389598a83c726eb73f.tar.gz lanes-5a5fb7c8b359582bb684c1389598a83c726eb73f.tar.bz2 lanes-5a5fb7c8b359582bb684c1389598a83c726eb73f.zip |
foward on_state_create error to main state if any
Diffstat (limited to 'src/tools.c')
-rw-r--r-- | src/tools.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tools.c b/src/tools.c index 9961c1a..0fcb2f1 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -538,7 +538,11 @@ lua_State* luaG_newstate( lua_State* _from, int const _on_state_create, char con | |||
538 | luaG_inter_move( _from, L, 1); | 538 | luaG_inter_move( _from, L, 1); |
539 | STACK_END( _from, 0); | 539 | STACK_END( _from, 0); |
540 | } | 540 | } |
541 | lua_call( L, 0, 0); | 541 | // capture error and forward it to main state |
542 | if( lua_pcall( L, 0, 0, 0) != LUA_OK) | ||
543 | { | ||
544 | luaL_error( _from, "on_state_create failed: \"%s\"", lua_isstring( L, -1) ? lua_tostring( L, -1) : lua_typename( L, lua_type( L, -1))); | ||
545 | } | ||
542 | STACK_MID( L, 0); | 546 | STACK_MID( L, 0); |
543 | } | 547 | } |
544 | 548 | ||