diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-06 11:13:54 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-06 11:13:54 +0200 |
commit | c9db798d184ceb8b3913a2f15d454f20ea978864 (patch) | |
tree | a9c02fc7afd3006dab2100c5399859ff9a5b7ca2 /src | |
parent | 2a2edc1071f314f65fdd9c3bf8af888921c32830 (diff) | |
download | lanes-c9db798d184ceb8b3913a2f15d454f20ea978864.tar.gz lanes-c9db798d184ceb8b3913a2f15d454f20ea978864.tar.bz2 lanes-c9db798d184ceb8b3913a2f15d454f20ea978864.zip |
Improve error message on table transfer type mismatch
Diffstat (limited to 'src')
-rw-r--r-- | src/tools.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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 }; | |||
590 | lua_pop(L2, 2); // L1: ... t ... L2: | 590 | lua_pop(L2, 2); // L1: ... t ... L2: |
591 | STACK_CHECK(L2, 0); | 591 | STACK_CHECK(L2, 0); |
592 | return false; | 592 | return false; |
593 | } else if (!lua_istable(L2, -1)) { | 593 | } 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 |
594 | char const *from, *to; | ||
595 | lua_getglobal(L1, "decoda_name"); // L1: ... t ... decoda_name | 594 | lua_getglobal(L1, "decoda_name"); // L1: ... t ... decoda_name |
596 | from = lua_tostring(L1, -1); | 595 | char const* from{ lua_tostring(L1, -1) }; |
597 | lua_pop(L1, 1); // L1: ... t ... | 596 | lua_pop(L1, 1); // L1: ... t ... |
598 | lua_getglobal(L2, "decoda_name"); // L1: ... t ... L2: {} t decoda_name | 597 | lua_getglobal(L2, "decoda_name"); // L1: ... t ... L2: {} t decoda_name |
599 | to = lua_tostring(L2, -1); | 598 | char const* to{ lua_tostring(L2, -1) }; |
600 | lua_pop(L2, 1); // L1: ... t ... L2: {} t | 599 | lua_pop(L2, 1); // L1: ... t ... L2: {} t |
601 | raise_luaL_error( | 600 | raise_luaL_error( |
602 | getErrL(), | 601 | getErrL(), |
603 | "INTERNAL ERROR IN %s: table '%s' not found in %s destination transfer database.", | 602 | "%s: source table '%s' found as %s in %s destination transfer database.", |
604 | from ? from : "main", | 603 | from ? from : "main", |
605 | fqn, | 604 | fqn, |
605 | lua_typename(L2, lua_type_as_enum(L2, -1)), | ||
606 | to ? to : "main" | 606 | to ? to : "main" |
607 | ); | 607 | ); |
608 | } | 608 | } |