This commit is contained in:
Andrew Haynes
2026-03-30 00:25:15 -04:00
parent 8653df28bc
commit a31c0de871
1727 changed files with 1174181 additions and 94 deletions
@@ -0,0 +1,28 @@
local function mergeKey(key, k)
if not key then
return k
end
k = tostring(k)
if k:sub(1, 1):match '%w' then
return key .. '.' .. k
else
return key .. k
end
end
local function proxy(results, key)
return setmetatable({}, {
__index = function (_, k)
return proxy(results, mergeKey(key, k))
end,
__newindex = function (_, k, v)
results[mergeKey(key, k)] = v
end
})
end
return function (text, path, results)
results = results or {}
assert(load(text, '@' .. path, "t", proxy(results)))()
return results
end