Fix nodes component type check

This commit is contained in:
Insality 2020-05-24 23:19:49 +03:00
parent 474b97469e
commit e621edd654

View File

@ -109,13 +109,15 @@ function Component.get_node(self, node_or_name)
template_name = template_name .. "/" template_name = template_name .. "/"
end end
local node_type = type(node_or_name)
if nodes then if nodes then
assert(type(node_or_name) == "strings", "You should pass node name instead of node") assert(node_type == const.STRING, "You should pass node name instead of node")
return nodes[template_name .. node_or_name] return nodes[template_name .. node_or_name]
else else
if type(node_or_name) == const.STRING then if node_type == const.STRING then
return gui.get_node(template_name .. node_or_name) return gui.get_node(template_name .. node_or_name)
else else
-- Assume it's already node from gui.get_node
return node_or_name return node_or_name
end end
end end