check_widget(): Also check .is_widget entry
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
b1e7d3c22c
commit
1dd63b04de
|
@ -559,7 +559,8 @@ end
|
||||||
--- Do some sanity checking on widget. This function raises a lua error if
|
--- Do some sanity checking on widget. This function raises a lua error if
|
||||||
-- widget is not a valid widget.
|
-- widget is not a valid widget.
|
||||||
function base.check_widget(widget)
|
function base.check_widget(widget)
|
||||||
assert(type(widget) == "table")
|
assert(type(widget) == "table", "Type should be table, but is " .. tostring(type(widget)))
|
||||||
|
assert(widget.is_widget, "Argument is not a widget!")
|
||||||
for _, func in pairs({ "add_signal", "connect_signal", "disconnect_signal" }) do
|
for _, func in pairs({ "add_signal", "connect_signal", "disconnect_signal" }) do
|
||||||
assert(type(widget[func]) == "function", func .. " is not a function")
|
assert(type(widget[func]) == "function", func .. " is not a function")
|
||||||
end
|
end
|
||||||
|
|
|
@ -84,6 +84,7 @@ return {
|
||||||
local w = object()
|
local w = object()
|
||||||
w:add_signal("widget::redraw_needed")
|
w:add_signal("widget::redraw_needed")
|
||||||
w:add_signal("widget::layout_changed")
|
w:add_signal("widget::layout_changed")
|
||||||
|
w.is_widget = true
|
||||||
w.visible = true
|
w.visible = true
|
||||||
w.opacity = 1
|
w.opacity = 1
|
||||||
if width or height then
|
if width or height then
|
||||||
|
|
Loading…
Reference in New Issue