From aa5078fb5b0e9b766bc6ee952794dcc2c506d63f Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sat, 2 Oct 2021 20:08:05 +0200 Subject: [PATCH] Remove getkeys (doesn't actually work) --- src/client/game/symbols.hpp | 1 + src/client/game/ui_scripting/lua/context.cpp | 22 ++++---------------- src/client/game/ui_scripting/types.cpp | 19 ----------------- src/client/game/ui_scripting/types.hpp | 3 --- 4 files changed, 5 insertions(+), 40 deletions(-) diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 939784dc..da50796a 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -160,6 +160,7 @@ namespace game WEAK symbol hksi_lua_pushvalue{0x2DE040}; WEAK symbol Hashtable_Create{0x2C8290}; WEAK symbol Hashtable_getNextHash{0x2D5150}; + WEAK symbol hks_obj_next{0x2DA850}; WEAK symbol cclosure_Create{0x2C84B0}; } diff --git a/src/client/game/ui_scripting/lua/context.cpp b/src/client/game/ui_scripting/lua/context.cpp index 4ebd826a..88f75bd7 100644 --- a/src/client/game/ui_scripting/lua/context.cpp +++ b/src/client/game/ui_scripting/lua/context.cpp @@ -1071,25 +1071,11 @@ namespace ui_scripting::lua table.set(name, convert({s, value})); }; - table_type[sol::meta_function::length] = [](const table& table) - { - return table.size(); - }; - - table_type["getkeys"] = [](const table& table, const sol::this_state s) - { - std::vector result; - const auto keys = table.get_keys(); - - for (const auto& key : keys) - { - result.push_back(convert(s, key)); - } - - return result; - }; - state["luiglobals"] = table((*::game::hks::lua_state)->globals.v.table); + state["CoD"] = state["luiglobals"]["CoD"]; + state["LUI"] = state["luiglobals"]["LUI"]; + state["Engine"] = state["luiglobals"]["Engine"]; + state["Game"] = state["luiglobals"]["Game"]; auto function_type = state.new_usertype("function_"); diff --git a/src/client/game/ui_scripting/types.cpp b/src/client/game/ui_scripting/types.cpp index 0f501bf1..e9ab451c 100644 --- a/src/client/game/ui_scripting/types.cpp +++ b/src/client/game/ui_scripting/types.cpp @@ -52,25 +52,6 @@ namespace ui_scripting { } - arguments table::get_keys() const - { - arguments keys{}; - auto current = this->ptr->m_hashPart; - - while (current->m_key.t) - { - keys.push_back(current->m_key); - current++; - } - - return keys; - } - - unsigned int table::size() const - { - return static_cast(this->get_keys().size()); - } - void table::set(const value& key, const value& value) const { set_field(*this, key, value); diff --git a/src/client/game/ui_scripting/types.hpp b/src/client/game/ui_scripting/types.hpp index bfcfb7ed..0e2590ca 100644 --- a/src/client/game/ui_scripting/types.hpp +++ b/src/client/game/ui_scripting/types.hpp @@ -29,9 +29,6 @@ namespace ui_scripting table(); table(game::hks::HashTable* ptr_); - arguments get_keys() const; - unsigned int size() const; - value get(const value& key) const; void set(const value& key, const value& value) const;