Druid-Extension/druid/druid_widget.gui_script
2025-04-19 19:01:39 +03:00

31 lines
926 B
Lua

--- Attach this script to your GUI file instead custom *.gui_script file
--- This allows to grab a widget from the GO scripts by gui_url
--- To do this you need to call `druid.get_widget` in the GO script
--- The new widget will be created and returned to GO script
--- And now all top level functions from the widget will be available in the GO script
--- Use with caution, this is a new feature, but allow utilize flexability of `event` module
local druid = require("druid.druid")
function init(self)
self.druid = druid.new(self)
druid.register_druid_as_widget(self.druid)
end
function final(self)
druid.unregister_druid_as_widget()
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end