1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-09-28 15:08:47 +00:00

Fix Bug with term.setCursorPos

I fixed 2 Bugs:
1. If you call this function, without 2 numbers, you get a error in the window API and not in your Program
2. If you call, this function with 2 numbers lower then 1 (e.g. term.setCursorPos(0,0) ), CraftOS will hang forever and need to press Ctrl+R or rejoin the world.
This commit is contained in:
Wilma456 2017-06-02 17:35:18 +02:00 committed by GitHub
parent 114c49e3f6
commit d6e4323f17

View File

@ -243,6 +243,12 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
end
function window.setCursorPos( x, y )
if type( x ) ~= "number" or type( y ) ~= "number" then
error( "Expected number, number", 2 )
end
if x < 1 or y < 1 then
error( "Position out of range", 2 )
end
nCursorX = math.floor( x )
nCursorY = math.floor( y )
if bVisible then