mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 20:56:37 +00:00
move widget attributes before children
This is mostly for perfromance reasons, sicne windget::find() might search quite a while (relertively) in the wirst case
This commit is contained in:
parent
ae2b7fc2de
commit
a158eef0d0
@ -417,10 +417,6 @@ int impl_widget_get(lua_State* L)
|
||||
|
||||
}
|
||||
utils::string_view str = lua_check<utils::string_view>(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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user