From ee7da224f1000911b8643fe899497b76061900e8 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Sun, 20 Aug 2017 16:01:25 +1000 Subject: [PATCH] made io buffers actually write, hopefully. --- modules/lib/io.lua | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/modules/lib/io.lua b/modules/lib/io.lua index ce91766..701a7c4 100644 --- a/modules/lib/io.lua +++ b/modules/lib/io.lua @@ -4,20 +4,11 @@ io.write = write function io.open(n,m) m=m or "rb" local h=fs.open(n,m) - if h then if h and m:sub(1,1) == "w" then bt=buffer.ucreate() - spawn("io worker: "..n,function() - while true do - if bt.s ~= "open" and bt.b == "" then fclose(h) break end - nd = bt.b - if nd ~= nil and nd ~= "" then - fs.write(h,nd) - end - bt.b = "" - coroutine.yield() + function bt.write(d) + return fs.write(h,d) end - end) return bt elseif h and m:sub(1,1) == "r" then bt = buffer.ucreate() @@ -29,7 +20,6 @@ function io.open(n,m) fs.close(h) coroutine.yield() return bt - end else return false end