From 98553f7f1fa3b19bb1e1756c15776cef522bae99 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 13 Nov 2013 16:40:08 +0100 Subject: Fix a case where an error could be raised inside a keeper state --- src/tools.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools.c b/src/tools.c index f9b34be..0c07a3b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1593,7 +1593,8 @@ static void lookup_native_func( lua_State* L2, lua_State* L, uint_t i, enum eLoo from = lua_tostring( L, -1); lua_getglobal( L2, "decoda_name"); // {} f decoda_name to = lua_tostring( L2, -1); - (void) luaL_error( L, "%s: function '%s' not found in %s destination transfer database.", from ? from : "main", fqn, to ? to : "main"); + // when mode_ == eLM_FromKeeper, L is a keeper state and L2 is not, therefore L2 is the state where we want to raise the error + (void) luaL_error( (mode_ == eLM_FromKeeper) ? L2 : L, "%s: function '%s' not found in %s destination transfer database.", from ? from : "main", fqn, to ? to : "main"); return; } lua_remove( L2, -2); // f -- cgit v1.2.3-55-g6feb