2017-04-20 01:05:59 +10:00
|
|
|
hT = {["_c"]=0}
|
|
|
|
function fopen(p,m)
|
|
|
|
local d,p = fres(p)
|
2017-04-23 19:05:16 +10:00
|
|
|
local f,C=d.open(p,m),hT._c
|
2017-04-20 01:05:59 +10:00
|
|
|
if f then
|
2017-04-23 19:05:16 +10:00
|
|
|
hT._c = C + 1
|
|
|
|
hT[C] = {d,f}
|
|
|
|
return C
|
2017-04-20 01:05:59 +10:00
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
function fclose(h)
|
|
|
|
if hT[h] then
|
|
|
|
hT[h][1].close(hT[h][2])
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
function fread(h,n)
|
|
|
|
if hT[h] then
|
|
|
|
return hT[h][1].read(hT[h][2],n)
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
function fwrite(h,d)
|
|
|
|
if hT[h] then
|
|
|
|
return hT[h][1].write(hT[h][2],d)
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|