From d8b969e78da94fea095d19f61e20dba2defc12c8 Mon Sep 17 00:00:00 2001 From: robin Date: Sun, 16 Aug 2026 23:09:37 +0200 Subject: [PATCH] maivi: parse child args correctly and avoid props type issues --- src/lua/runtime/maivi.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lua/runtime/maivi.lua b/src/lua/runtime/maivi.lua index 73abc5d..f179d54 100644 --- a/src/lua/runtime/maivi.lua +++ b/src/lua/runtime/maivi.lua @@ -88,7 +88,7 @@ function maivi.elem(etype, config) end end ----@param args PropsOrChildren +---@param args PropsOrChildren? ---@return ParsedArgs function maivi.parse(args) ---@type Props @@ -98,15 +98,15 @@ function maivi.parse(args) ---@type string[] local boolean_props = {} - if type(args) == "table" then + if type(args) == "table" and getmetatable(args) == nil then for k, v in pairs(args) do if type(k) == "number" then table.insert(children, v) - elseif k == "_" then + elseif k == "_" and type(v) == "table" then for _, prop in ipairs(v) do table.insert(boolean_props, prop) end - elseif k == "data" then + elseif k == "data" and type(v) == "table" then for kdata, prop in pairs(v) do props["data-" .. kdata] = maivi.display.attr(prop) end @@ -114,7 +114,7 @@ function maivi.parse(args) props[k] = maivi.display.attr(v) end end - elseif args then + elseif args ~= nil then table.insert(children, args) end -- 2.51.2