1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
This commit is contained in:
uramer 2023-01-29 19:36:21 +01:00
parent 749c89e26e
commit 259f104311
3 changed files with 7 additions and 6 deletions

View File

@ -79,7 +79,8 @@ namespace LuaUi::Content
{
if (index < size())
// for some reason mTable[key] = value doesn't call __newindex
mTable[sol::metatable_key][sol::meta_function::new_index].get<sol::protected_function>()(mTable, toLua(index), sol::nil);
mTable[sol::metatable_key][sol::meta_function::new_index].get<sol::protected_function>()(
mTable, toLua(index), sol::nil);
else
throw std::domain_error("Invalid Content index");
}

View File

@ -34,10 +34,6 @@ local function getIndexFromKey(self, key)
validateIndex(self, index)
return index
end
local function nameAt(self, index)
local v = rawget(self, index)
return v and type(v.name) == 'string' and v.name
end
local methods = {
insert = function(self, index, value)
validateIndex(self, index)
@ -78,6 +74,10 @@ M.__index = function(self, key)
local index = getIndexFromKey(self, key)
return rawget(self, index)
end
local function nameAt(self, index)
local v = rawget(self, index)
return v and type(v.name) == 'string' and v.name
end
local function remove(self, index)
local oldName = nameAt(self, index)
if oldName then