From bd47f28048f45efe00113e079e7d927538bd65d4 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 4 Nov 2026 23:25:26 +0000 Subject: [PATCH] Decompile fn_18333 (LuaScript::TableInteger) Batch #11091 by kyoshi: 0 byte-identical, 1 confirmed by peer review. - fn_18333 LuaScript::TableInteger: logic confirmed by peer review Peer-reviewed-by: Yommy, cremane, StrawberrysherbetIX Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Script/LuaScript.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index 0e69c553..f6d03bf2 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -1221,25 +1221,19 @@ int LuaScript::TableInteger(std::string table, int keyType, std::intptr_t key) { int value = -1; lua_getglobal(this->m_state, table.c_str()); - if (lua_type(this->m_state, -1) != LUA_TTABLE) { - return value; - } + if (lua_type(this->m_state, -1) == LUA_TTABLE) { + std::string signature; - if (keyType == 0) { - lua_pushnumber(this->m_state, static_cast(key)); - lua_gettable(this->m_state, -2); - } else if (keyType == 1) { - lua_pushstring(this->m_state, reinterpret_cast(key)); - lua_gettable(this->m_state, -2); - } else if (keyType != 2) { - lua_pushnumber(this->m_state, static_cast(key)); - lua_gettable(this->m_state, -2); - return value; - } + if (keyType == 0) { + signature = "d"; + } else if (keyType == 1) { + signature = "s"; + } else if (keyType == 2) { + signature = "l"; + } - if (lua_isnumber(this->m_state, -1)) { - value = static_cast(lua_tonumber(this->m_state, -1)); - lua_pop(this->m_state, 1); + signature += "d"; + this->TableField(signature.c_str(), key, &value); } return value;