lua_widget

dt_type

Common parent type for all lua-handled widgets

Attributes:

🔗lua_widget.extra registration parameters

This widget has no extra registration parameters

🔗lua_widget.sensitive

boolean

Set if the widget is enabled/disabled

Attributes:

🔗lua_widget.tooltip

string or nil

Tooltip to display for the widget

Attributes:

🔗lua_widget.reset_callback

function(
  widget : types.lua_widget
)

A function to call when the widget needs to reset itself Note that some widgets have a default implementation that can be overridden, (containers in particular will recursively reset their children). If you replace that default implementation you need to reimplement that functionality or call the original function within your callback

Attributes:

🔗lua_widget.As a function

function(
  attributes : table
) : types.lua_widget

Using a lua widget as a function Allows to set multiple attributes of that widget at once. This is mainly used to create UI elements in a more readable way.

For example:

local widget = dt.new_widget("button"){
  label ="my label",
  clicked_callback = function() print "hello world" end
}
  • attributes - table - A table of attributes => value to set
  • return - types.lua_widget - The object called itself, to allow chaining