1
0
mirror of https://github.com/kepler155c/opus synced 2024-06-15 01:39:59 +00:00
This commit is contained in:
kepler155c@gmail.com 2017-06-02 15:42:40 -04:00
parent 3f3edefa7b
commit 890fad5099

View File

@ -37,7 +37,7 @@ end
function urlfs.open(node, fn, fl)
if fl ~= 'r' then
if fl ~= 'r' and fl ~= 'rb' then
error('Unsupported mode')
end
@ -58,19 +58,31 @@ function urlfs.open(node, fn, fl)
local ctr = 0
local lines
if fl == 'r' then
return {
readLine = function()
if not lines then
lines = Util.split(c)
end
ctr = ctr + 1
return lines[ctr]
end,
readAll = function()
return c
end,
close = function()
lines = nil
end,
}
end
return {
readLine = function()
if not lines then
lines = Util.split(c)
end
read = function()
ctr = ctr + 1
return lines[ctr]
end,
readAll = function()
return c
return c:sub(ctr, ctr)
end,
close = function()
lines = nil
ctr = 0
end,
}
end