diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2012-10-23 15:08:59 +0300 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2012-10-23 15:08:59 +0300 |
commit | 640ea0fb3df69dd7b629bb6060d753277590605d (patch) | |
tree | eae8808bae9d3a1517ff4e8a033eedb1b6e7288e /src/tools.c | |
parent | c615818c97b1e589fb8c634f3cc99039657a90b6 (diff) | |
download | lanes-640ea0fb3df69dd7b629bb6060d753277590605d.tar.gz lanes-640ea0fb3df69dd7b629bb6060d753277590605d.tar.bz2 lanes-640ea0fb3df69dd7b629bb6060d753277590605d.zip |
Fixed thread name retrieval in main state.
Diffstat (limited to 'src/tools.c')
-rw-r--r-- | src/tools.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools.c b/src/tools.c index a9ca956..801b63a 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -1325,11 +1325,13 @@ static void lookup_native_func( lua_State* L2, lua_State* L, uint_t i) | |||
1325 | lua_pop( L, 2); // ... f ... | 1325 | lua_pop( L, 2); // ... f ... |
1326 | if( !fqn) | 1326 | if( !fqn) |
1327 | { | 1327 | { |
1328 | char const* from; | ||
1328 | lua_pushvalue( L, i); // ... f ... f | 1329 | lua_pushvalue( L, i); // ... f ... f |
1329 | // try to discover the name of the function we want to send | 1330 | // try to discover the name of the function we want to send |
1330 | luaG_nameof( L); // ... f ... "type" "name" | 1331 | luaG_nameof( L); // ... f ... "type" "name" |
1331 | lua_getglobal( L, "decoda_name"); // ... f ... "type" "name" decoda_name | 1332 | lua_getglobal( L, "decoda_name"); // ... f ... "type" "name" decoda_name |
1332 | (void) luaL_error( L, "%s '%s' not found in %s origin transfer database.", lua_tostring( L, -3), lua_tostring( L, -2), lua_tostring( L, -1)); | 1333 | from = lua_tostring( L, -1); |
1334 | (void) luaL_error( L, "%s '%s' not found in %s origin transfer database.", lua_tostring( L, -3), lua_tostring( L, -2), from ? from : "main"); | ||
1333 | return; | 1335 | return; |
1334 | } | 1336 | } |
1335 | STACK_END( L, 0) | 1337 | STACK_END( L, 0) |
@@ -1341,9 +1343,12 @@ static void lookup_native_func( lua_State* L2, lua_State* L, uint_t i) | |||
1341 | lua_rawget( L2, -2); // {} f | 1343 | lua_rawget( L2, -2); // {} f |
1342 | if( !lua_isfunction( L2, -1)) | 1344 | if( !lua_isfunction( L2, -1)) |
1343 | { | 1345 | { |
1346 | char const* from, * to; | ||
1344 | lua_getglobal( L, "decoda_name"); // // ... f ... decoda_name | 1347 | lua_getglobal( L, "decoda_name"); // // ... f ... decoda_name |
1348 | from = lua_tostring( L, -1); | ||
1345 | lua_getglobal( L2, "decoda_name"); // {} f decoda_name | 1349 | lua_getglobal( L2, "decoda_name"); // {} f decoda_name |
1346 | (void) luaL_error( L, "%s: function '%s' not found in %s destination transfer database.", lua_tostring( L, -1), lua_tostring( L2, -1), fqn); | 1350 | to = lua_tostring( L2, -1); |
1351 | (void) luaL_error( L, "%s: function '%s' not found in %s destination transfer database.", from ? from : "main", to ? to : "main", fqn); | ||
1347 | return; | 1352 | return; |
1348 | } | 1353 | } |
1349 | lua_remove( L2, -2); // f | 1354 | lua_remove( L2, -2); // f |