mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 16:57:32 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.7.10
This commit is contained in:
commit
c0a7b84c3a
@ -13,6 +13,9 @@ local unicode = require("unicode")
|
||||
local memoryStream = {}
|
||||
|
||||
function memoryStream:close()
|
||||
if (self.empty) then
|
||||
self:write('')
|
||||
end
|
||||
self.closed = true
|
||||
end
|
||||
|
||||
@ -37,6 +40,7 @@ function memoryStream:read(n)
|
||||
end
|
||||
|
||||
function memoryStream:write(value)
|
||||
self.empty = false
|
||||
if not self.redirect.write and self.closed then
|
||||
error("attempt to use a closed stream")
|
||||
end
|
||||
@ -59,7 +63,7 @@ end
|
||||
|
||||
function memoryStream.new()
|
||||
local stream = {closed = false, buffer = "",
|
||||
redirect = {}, result = {}, args = {}}
|
||||
redirect = {}, result = {}, args = {}, empty = true}
|
||||
local metatable = {__index = memoryStream,
|
||||
__gc = memoryStream.close,
|
||||
__metatable = "memorystream"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user