diff --git a/src/scripting/lua_widget_attributes.cpp b/src/scripting/lua_widget_attributes.cpp index a7b6753f0d1..1be1b097928 100644 --- a/src/scripting/lua_widget_attributes.cpp +++ b/src/scripting/lua_widget_attributes.cpp @@ -417,10 +417,6 @@ int impl_widget_get(lua_State* L) } utils::string_view str = lua_check(L, 2); - if(auto pwidget = find_child_by_name(w, std::string(str))) { - luaW_pushwidget(L, *pwidget); - return 1; - } tgetters::iterator it = getters.find(std::string(str)); if(it != getters.end()) { @@ -433,6 +429,10 @@ int impl_widget_get(lua_State* L) if(luaW_getglobal(L, "gui", "widget", std::string(str).c_str())) { return 1; } + if(auto pwidget = find_child_by_name(w, std::string(str))) { + luaW_pushwidget(L, *pwidget); + return 1; + } ERR_LUA << "invalid propertly of '" << typeid(w).name()<< "' widget :" << str << "\n"; return luaL_argerror(L, 2, "invalid propertly of widget"); }