Remove getkeys (doesn't actually work)

This commit is contained in:
Federico Cecchetto 2021-10-02 20:08:05 +02:00
parent 9d1552c246
commit aa5078fb5b
4 changed files with 5 additions and 40 deletions

View File

@ -160,6 +160,7 @@ namespace game
WEAK symbol<void(lua_State* s, int index)> hksi_lua_pushvalue{0x2DE040};
WEAK symbol<HashTable*(lua_State* s, unsigned int arraySize, unsigned int hashSize)> Hashtable_Create{0x2C8290};
WEAK symbol<HksObject*(HashTable* t, HksObject* result, HksObject* key)> Hashtable_getNextHash{0x2D5150};
WEAK symbol<void(lua_State* s, const HksObject* tbl, HksObject* key, HksObject* retval)> hks_obj_next{0x2DA850};
WEAK symbol<cclosure*(lua_State* s, lua_function function, int num_upvalues,
int internal_, int profilerTreatClosureAsFunc)> cclosure_Create{0x2C84B0};
}

View File

@ -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<sol::lua_value> 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>("function_");

View File

@ -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<unsigned int>(this->get_keys().size());
}
void table::set(const value& key, const value& value) const
{
set_field(*this, key, value);

View File

@ -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;