mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 17:28:52 -04:00
simplify tty check slightly and add comment that tty should not be used directly by user code
maybe i should just move tty to /lib/core
This commit is contained in:
parent
40ca104a75
commit
f00c2dd6a2
@ -261,12 +261,12 @@ function tty.internal.build_vertical_reader()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- read n bytes, n is unused
|
-- PLEASE do not use this method directly, use io.read or tty.read
|
||||||
function tty.read(self, handler, cursor)
|
function tty.read(_, handler, cursor)
|
||||||
checkArg(1, handler, "table", "number")
|
checkArg(1, handler, "table", "number")
|
||||||
checkArg(2, cursor, "table", "nil")
|
checkArg(2, cursor, "table", "nil")
|
||||||
|
|
||||||
if not io.stdin.tty or io.stdin.stream ~= self then
|
if not io.stdin.tty then
|
||||||
return io.stdin:readLine(false)
|
return io.stdin:readLine(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -320,8 +320,9 @@ function tty.setCursor(x, y)
|
|||||||
window.x, window.y = x, y
|
window.x, window.y = x, y
|
||||||
end
|
end
|
||||||
|
|
||||||
function tty.write(self, value)
|
-- PLEASE do not use this method directly, use io.write or term.write
|
||||||
if not io.stdout.tty or io.stdout.stream ~= self then
|
function tty.write(_, value)
|
||||||
|
if not io.stdout.tty then
|
||||||
return io.write(value)
|
return io.write(value)
|
||||||
end
|
end
|
||||||
local gpu = tty.gpu()
|
local gpu = tty.gpu()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user