This commit is contained in:
Insality
2025-04-19 22:25:58 +03:00
parent 4cb16de782
commit c7b11562d5
8 changed files with 51 additions and 25 deletions

View File

@@ -33,8 +33,16 @@ end
---@param name string Module name
---@param module table Lua table with component
function M.register(name, module)
druid_instance["new_" .. name] = function(self, ...)
return druid_instance.new(self, module, ...)
local is_custom_component = getmetatable(module) ~= nil
if is_custom_component then
druid_instance["new_" .. name] = function(self, ...)
return druid_instance.new(self, module, ...)
end
else
-- Just for some compatability. But better to use direct druid_instance:new_widget(module, ...) function
druid_instance["new_" .. name] = function(self, template, nodes, ...)
return druid_instance.new_widget(self, module, template, nodes, ...)
end
end
end