Add nested lookup
This commit is contained in:
parent
f3dab5753e
commit
1a739d3af2
1 changed files with 7 additions and 1 deletions
|
@ -8,7 +8,13 @@ local config = {}
|
||||||
|
|
||||||
local __metatable = {}
|
local __metatable = {}
|
||||||
function __metatable:__index(index)
|
function __metatable:__index(index)
|
||||||
if type(index)~="string" then return nil end
|
if type(index)~="string" then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local dot = index:find(".", 1, true)
|
||||||
|
if dot then
|
||||||
|
return self[index:sub(1, dot-1)][index:sub(dot+1)]
|
||||||
|
end
|
||||||
local path = self.__dir..'/'..index
|
local path = self.__dir..'/'..index
|
||||||
local attributes = lfs.attributes(path)
|
local attributes = lfs.attributes(path)
|
||||||
if attributes and attributes.mode=='directory' then
|
if attributes and attributes.mode=='directory' then
|
||||||
|
|
Loading…
Reference in a new issue