mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-27 09:24: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:
parent
114c49e3f6
commit
d6e4323f17
@ -243,6 +243,12 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
|
|||||||
end
|
end
|
||||||
|
|
||||||
function window.setCursorPos( x, y )
|
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 )
|
nCursorX = math.floor( x )
|
||||||
nCursorY = math.floor( y )
|
nCursorY = math.floor( y )
|
||||||
if bVisible then
|
if bVisible then
|
||||||
|
Loading…
Reference in New Issue
Block a user