FS library updates

This commit is contained in:
Izaya 2017-06-12 14:28:15 +00:00
parent ed85e857ff
commit eaa4eb7d86
2 changed files with 10 additions and 7 deletions

View File

@ -21,6 +21,14 @@ function fread(h,n)
end
return false
end
function freadall(f)
local s=""
repeat
c=fread(f,2048)
s=s..c
until c==""
return s
end
function fwrite(h,d)
if hT[h] then
return hT[h][1].write(hT[h][2],d)

View File

@ -17,14 +17,9 @@ function fmove(i,o)
frm(i)
end
function fload(i)
local f,s = fopen(i,"rb"),""
local f = fopen(i,"rb")
if f then
local c=fread(f,math.huge)
repeat
s=s..c
c=fread(f,math.huge)
until c == nil
return load(s)
return load(freadall(f))
end
return false
end