summaryrefslogtreecommitdiffstats
path: root/acf/path.lua
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-06-28 23:50:18 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-09-04 15:24:08 +0300
commit4c1cc6f54edc35a4aa2f1553bc9ce372a2b77695 (patch)
treed4142961891040a433add8ea3d350be4c6d58471 /acf/path.lua
parent25ffc62a5b2c9a65e5c1689d5351adcf8cbef7e2 (diff)
downloadaconf-4c1cc6f54edc35a4aa2f1553bc9ce372a2b77695.tar.bz2
aconf-4c1cc6f54edc35a4aa2f1553bc9ce372a2b77695.tar.xz
eliminate explicit use of string module
Diffstat (limited to 'acf/path.lua')
-rw-r--r--acf/path.lua10
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 = ''