mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
fixed io.type
This commit is contained in:
parent
9886e646de
commit
a73ed001dd
@ -220,7 +220,7 @@ local file = {}
|
|||||||
function file:close()
|
function file:close()
|
||||||
if self.handle then
|
if self.handle then
|
||||||
self:flush()
|
self:flush()
|
||||||
self.stream:close()
|
return self.stream:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -503,7 +503,7 @@ function file.new(fs, handle, mode, stream, nogc)
|
|||||||
|
|
||||||
local metatable = {
|
local metatable = {
|
||||||
__index = file,
|
__index = file,
|
||||||
__metatable = "private"
|
__metatable = "file"
|
||||||
}
|
}
|
||||||
if not nogc then
|
if not nogc then
|
||||||
metatable.__gc = function(self)
|
metatable.__gc = function(self)
|
||||||
@ -561,9 +561,8 @@ end
|
|||||||
|
|
||||||
function driver.fs.type(object)
|
function driver.fs.type(object)
|
||||||
if type(object) == "table" then
|
if type(object) == "table" then
|
||||||
local mt = getmetatable(object)
|
if getmetatable(object) == "file" then
|
||||||
if mt and mt.__index == file then
|
if object.handle then
|
||||||
if f.handle then
|
|
||||||
return "file"
|
return "file"
|
||||||
else
|
else
|
||||||
return "closed file"
|
return "closed file"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user