mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
26 lines
749 B
Plaintext
26 lines
749 B
Plaintext
---This is a template for a {COMPONENT_NAME} Druid widget.
|
|
---Instantiate this template with `druid.new_widget(widget_module, [template_id], [nodes])`.
|
|
---Read more about Druid Widgets here: ...
|
|
|
|
---@class widget.{COMPONENT_TYPE}: druid.widget
|
|
local M = {}
|
|
|
|
|
|
function M:init()
|
|
-- Now we have next functions to use here:
|
|
-- self:get_node([node_id]) -- Get node inside widget by id
|
|
-- self.druid to access Druid Instance API, like:
|
|
-- self.druid:new_button([node_id], [callback])
|
|
-- self.druid:new_text([node_id], [text])
|
|
-- And all functions from component.lua file
|
|
self.root = self:get_node("root")
|
|
self.button = self.druid:new_button("button", self.on_button, self)
|
|
end
|
|
|
|
|
|
function M:on_button()
|
|
print("Root node", self.root)
|
|
end
|
|
|
|
|
|
return M |