diff --git a/apps/openmw_test_suite/lua/test_ui_content.cpp b/apps/openmw_test_suite/lua/test_ui_content.cpp index 57b744b005..cceb7b342a 100644 --- a/apps/openmw_test_suite/lua/test_ui_content.cpp +++ b/apps/openmw_test_suite/lua/test_ui_content.cpp @@ -119,7 +119,7 @@ namespace auto table = makeTable(); LuaUi::Content::View content = makeContent(table); EXPECT_ANY_THROW(content.at(0)); - EXPECT_EQ(content.size(), 0); + EXPECT_EQ(content.size(), 0); content.assign(content.size(), makeTable()); EXPECT_EQ(content.size(), 1); content.assign(content.size(), makeTable()); diff --git a/components/lua_ui/content.hpp b/components/lua_ui/content.hpp index 72db6440d3..8b641037ef 100644 --- a/components/lua_ui/content.hpp +++ b/components/lua_ui/content.hpp @@ -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()(mTable, toLua(index), sol::nil); + mTable[sol::metatable_key][sol::meta_function::new_index].get()( + mTable, toLua(index), sol::nil); else throw std::domain_error("Invalid Content index"); } diff --git a/components/lua_ui/content.lua b/components/lua_ui/content.lua index 6e536358a7..8c0e935bb9 100644 --- a/components/lua_ui/content.lua +++ b/components/lua_ui/content.lua @@ -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