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