From c9db798d184ceb8b3913a2f15d454f20ea978864 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 6 May 2024 11:13:54 +0200 Subject: Improve error message on table transfer type mismatch --- src/tools.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/tools.cpp b/src/tools.cpp index 302d4cc..2d48552 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -590,19 +590,19 @@ static constexpr RegistryUniqueKey kMtIdRegKey{ 0xA8895DCF4EC3FE3Cull }; lua_pop(L2, 2); // L1: ... t ... L2: STACK_CHECK(L2, 0); return false; - } else if (!lua_istable(L2, -1)) { - char const *from, *to; + } else if (!lua_istable(L2, -1)) { // this can happen if someone decides to replace same already registered item (for a example a standard lib function) with a table lua_getglobal(L1, "decoda_name"); // L1: ... t ... decoda_name - from = lua_tostring(L1, -1); + char const* from{ lua_tostring(L1, -1) }; lua_pop(L1, 1); // L1: ... t ... lua_getglobal(L2, "decoda_name"); // L1: ... t ... L2: {} t decoda_name - to = lua_tostring(L2, -1); + char const* to{ lua_tostring(L2, -1) }; lua_pop(L2, 1); // L1: ... t ... L2: {} t raise_luaL_error( getErrL(), - "INTERNAL ERROR IN %s: table '%s' not found in %s destination transfer database.", + "%s: source table '%s' found as %s in %s destination transfer database.", from ? from : "main", fqn, + lua_typename(L2, lua_type_as_enum(L2, -1)), to ? to : "main" ); } -- cgit v1.2.3-55-g6feb