MCPcopy Create free account
hub / github.com/OpenMW/openmw / widgetType

Function widgetType

components/lua_ui/element.cpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 constexpr uint64_t maxDepth = 250;
33
34 std::string widgetType(const sol::table& layout)
35 {
36 sol::object typeField = LuaUtil::getFieldOrNil(layout, LayoutKeys::type);
37 std::string type = LuaUtil::getValueOrDefault(typeField, defaultWidgetType);
38 sol::object templateTypeField
39 = LuaUtil::getFieldOrNil(layout, LayoutKeys::templateLayout, LayoutKeys::type);
40 if (templateTypeField != sol::nil)
41 {
42 std::string templateType = LuaUtil::getValueOrDefault(templateTypeField, defaultWidgetType);
43 if (typeField != sol::nil && templateType != type)
44 throw std::logic_error(std::string("Template layout type ") + type
45 + std::string(" doesn't match template type ") + templateType);
46 type = std::move(templateType);
47 }
48 return type;
49 }
50
51 void destroyWidget(WidgetExtension* ext)
52 {

Callers 3

updateContentFunction · 0.85
createWidgetFunction · 0.85
updateMethod · 0.85

Calls 2

getFieldOrNilFunction · 0.85
getValueOrDefaultFunction · 0.85

Tested by

no test coverage detected