aboutsummaryrefslogtreecommitdiffstats
path: root/src/theming/lua-lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/theming/lua-lib')
-rw-r--r--src/theming/lua-lib/expect.lua6
-rw-r--r--src/theming/lua-lib/html.lua14
2 files changed, 13 insertions, 7 deletions
diff --git a/src/theming/lua-lib/expect.lua b/src/theming/lua-lib/expect.lua
index 9afbb49..20772b2 100644
--- a/src/theming/lua-lib/expect.lua
+++ b/src/theming/lua-lib/expect.lua
@@ -50,7 +50,7 @@ local function get_display_type(value, t)
-- Cobalt and only read the metatable for tables/userdata.
if t ~= "table" and t ~= "userdata" then return t end
- local metatable = debug.getmetatable(value)
+ local metatable = getmetatable(value)
if not metatable then return t end
local name = rawget(metatable, "__name")
@@ -72,8 +72,8 @@ local function expect(index, value, ...)
-- If we can determine the function name with a high level of confidence, try to include it.
local name
- local ok, info = pcall(debug.getinfo, 3, "nS")
- if ok and info.name and info.name ~= "" and info.what ~= "C" then name = info.name end
+ -- local ok, info = pcall(debug.getinfo, 3, "nS")
+ -- if ok and info.name and info.name ~= "" and info.what ~= "C" then name = info.name end
t = get_display_type(value, t)
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 })