From 907230e479ba6c9489463797f81c7348ed754302 Mon Sep 17 00:00:00 2001 From: Kevin <119447307+tokyob0t@users.noreply.github.com> Date: Thu, 23 Jan 2025 09:34:46 -0300 Subject: add: lua gtk3 examples (#156) --- lang/lua/astal/gtk3/astalify.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'lang/lua/astal') diff --git a/lang/lua/astal/gtk3/astalify.lua b/lang/lua/astal/gtk3/astalify.lua index 5bf3c1d..f1a280b 100644 --- a/lang/lua/astal/gtk3/astalify.lua +++ b/lang/lua/astal/gtk3/astalify.lua @@ -52,15 +52,20 @@ local function includes(tbl, elem) end local function set_children(parent, children) - children = map(flatten(children), function(item) - if Gtk.Widget:is_type_of(item) then - return item - end - return Gtk.Label({ - visible = true, - label = tostring(item), - }) - end) + children = map( + filter(flatten(children), function(item) + return not not item + end), + function(item) + if Gtk.Widget:is_type_of(item) then + return item + end + return Gtk.Label({ + visible = true, + label = tostring(item), + }) + end + ) -- remove if Gtk.Bin:is_type_of(parent) then -- cgit v1.2.3