blob: 6aa8b9854eb51cc052b88d370d7526bb477abe99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
local en = require("lang.en")
local function get(...)
local path
local node = en
local function f(...)
for _, comp in ipairs({...}) do
path = (path and (path .. ".") or "") .. comp
for x in comp:gmatch("[^%.]+") do
if type(node) == "table" then
node = node[x]
else
return
end
end
end
end
f(...)
if type(node) == "string" then
return node
else
return path or ""
end
end
-- ipairs({...})
return { get = get }
|