mirror of
https://github.com/kepler155c/opus
synced 2025-10-19 09:47:39 +00:00
webrun
This commit is contained in:
@@ -37,7 +37,7 @@ end
|
|||||||
|
|
||||||
function urlfs.open(node, fn, fl)
|
function urlfs.open(node, fn, fl)
|
||||||
|
|
||||||
if fl ~= 'r' then
|
if fl ~= 'r' and fl ~= 'rb' then
|
||||||
error('Unsupported mode')
|
error('Unsupported mode')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -58,19 +58,31 @@ function urlfs.open(node, fn, fl)
|
|||||||
|
|
||||||
local ctr = 0
|
local ctr = 0
|
||||||
local lines
|
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 {
|
return {
|
||||||
readLine = function()
|
read = function()
|
||||||
if not lines then
|
|
||||||
lines = Util.split(c)
|
|
||||||
end
|
|
||||||
ctr = ctr + 1
|
ctr = ctr + 1
|
||||||
return lines[ctr]
|
return c:sub(ctr, ctr)
|
||||||
end,
|
|
||||||
readAll = function()
|
|
||||||
return c
|
|
||||||
end,
|
end,
|
||||||
close = function()
|
close = function()
|
||||||
lines = nil
|
ctr = 0
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user