diff options
Diffstat (limited to 'acf/path.lua')
-rw-r--r-- | acf/path.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/acf/path.lua b/acf/path.lua index 4df0350..d824141 100644 --- a/acf/path.lua +++ b/acf/path.lua @@ -13,7 +13,7 @@ M.wildcard = {} local special = {['..']=up, ['*']=M.wildcard} -function M.is_absolute(path) return string.sub(path, 1, 1) == '/' end +function M.is_absolute(path) return path:sub(1, 1) == '/' end function M.escape(comp) @@ -21,7 +21,7 @@ function M.escape(comp) if comp == item then return symbol end end if type(comp) == 'number' then return tostring(comp) end - local res = string.gsub(comp, '([\\/])', '\\%1') + local res = comp:gsub('([\\/])', '\\%1') return (special[res] or tonumber(res)) and '\\'..res or res end @@ -49,7 +49,7 @@ function M.split(path) end while true do - local prefix, sep, suffix = string.match(path, '([^\\/]*)([\\/])(.*)') + local prefix, sep, suffix = path:match('([^\\/]*)([\\/])(.*)') if not prefix then merge(comp..path) return res @@ -57,9 +57,9 @@ function M.split(path) comp = comp..prefix if sep == '\\' then - comp = comp..string.sub(suffix, 1, 1) + comp = comp..suffix:sub(1, 1) escaped = true - path = string.sub(suffix, 2, -1) + path = suffix:sub(2, -1) else merge(comp) comp = '' |