From 79999cecedd84e99655fbcdba0bd4e715a22173f Mon Sep 17 00:00:00 2001 From: alyx Date: Fri, 5 Apr 2024 17:27:46 -0400 Subject: Lua support feature-complete Full implementation of debug mode still pending --- src/theming/lua-lib/html.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/theming/lua-lib/html.lua') diff --git a/src/theming/lua-lib/html.lua b/src/theming/lua-lib/html.lua index 386618b..6786f96 100644 --- a/src/theming/lua-lib/html.lua +++ b/src/theming/lua-lib/html.lua @@ -16,8 +16,8 @@ local function html(el, tbl) expect(1, el, "string") expect(2, tbl, "table") - innerHtml = "" - attributes = "" + local innerHtml = "" + local attributes = "" for k, v in pairs(tbl) do if type(k) == "string" then @@ -39,6 +39,12 @@ local function root(tbl) end return setmetatable( - { root = root }, + {}, { __call = html, - __index = function (idx) return function(tbl) html(idx, tbl) end end }) + __index = function (_, idx) + if idx == "root" then + return root + else + return function(tbl) return html(idx, tbl) end + end + end }) -- cgit v1.2.3-54-g00ecf