Small optimization && refactoring

This commit is contained in:
Insality
2023-07-15 15:56:06 +03:00
parent 337090e74c
commit 556e1a9bae
11 changed files with 33 additions and 46 deletions

View File

@@ -99,7 +99,7 @@ end
-- @tparam string template BaseComponent template name
-- @treturn BaseComponent @{BaseComponent}
function BaseComponent.set_template(self, template)
template = template or const.EMPTY_STRING
template = template or ""
local parent = self:get_parent_component()
if parent and IS_AUTO_TEMPLATE then
@@ -183,7 +183,7 @@ end
-- @tparam string|node node_or_name Node name or node itself
-- @treturn node Gui node
function BaseComponent.get_node(self, node_or_name)
if type(node_or_name) ~= const.STRING then
if type(node_or_name) ~= "string" then
-- Assume it's already node from gui.get_node
return node_or_name
end