From 0dc9f32b7abec832ba63d8a8cb8bc5d9a63b84a4 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 20 Sep 2020 23:51:22 +0300 Subject: [PATCH] Add druid:new instead of druid:create --- druid/system/druid_instance.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index f243a6c..0571e92 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -151,7 +151,24 @@ end -- @function druid:create -- @tparam Component component Component module -- @tparam args ... Other component params to pass it to component:init function -function Druid.create(self, component, ...) +-- @deprecated +function Druid:create(component, ...) + helper.deprecated("The druid:create is deprecated. Please use druid:new instead") + local instance = create(self, component) + + if instance.init then + instance:init(...) + end + + return instance +end + + +--- Create new druid component +-- @function druid:new +-- @tparam Component component Component module +-- @tparam args ... Other component params to pass it to component:init function +function Druid.new(self, component, ...) local instance = create(self, component) if instance.init then @@ -407,6 +424,7 @@ end -- @function druid:new_grid -- @tparam args ... grid init args -- @treturn Component grid component +-- @deprecated function Druid.new_grid(self, ...) helper.deprecated("The druid:new_grid is deprecated. Please use druid:new_static_grid instead") return Druid.create(self, static_grid, ...)