mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
rename create() to new()
This commit is contained in:
parent
832ebe5674
commit
87e6f6ef1f
@ -29,7 +29,7 @@ end
|
|||||||
function M.register(name, module)
|
function M.register(name, module)
|
||||||
-- TODO: Find better solution to creating elements?
|
-- TODO: Find better solution to creating elements?
|
||||||
_factory["new_" .. name] = function(factory, node_or_name, ...)
|
_factory["new_" .. name] = function(factory, node_or_name, ...)
|
||||||
_factory.create(factory, module, node_or_name, ...)
|
_factory.new(factory, module, node_or_name, ...)
|
||||||
end
|
end
|
||||||
log("Register component", name)
|
log("Register component", name)
|
||||||
end
|
end
|
||||||
@ -86,7 +86,7 @@ local function create(module, factory, name, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function _factory.create(factory, module, node_or_name, ...)
|
function _factory.new(factory, module, node_or_name, ...)
|
||||||
local instance = create(module, factory, node_or_name)
|
local instance = create(module, factory, node_or_name)
|
||||||
|
|
||||||
if instance.init then
|
if instance.init then
|
||||||
|
@ -30,8 +30,8 @@ function init(self)
|
|||||||
print("On button 1")
|
print("On button 1")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--alternative way of component registration
|
--alternative way of component creation
|
||||||
self.druid:create(druid.comps.button, "button_2", function()
|
self.druid:new(druid.comps.button, "button_2", function()
|
||||||
print("On button 2")
|
print("On button 2")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user