1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 19:20:29 +00:00

Added checks to window.setTextColor and window.setBackgroundColor

This commit is contained in:
Daniel Ratcliffe 2017-05-16 19:23:03 +01:00
parent 7f365c5102
commit 8c4331d15a

View File

@ -270,6 +270,11 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
end end
local function setTextColor( color ) local function setTextColor( color )
if type(color) ~= "number" then
error( "Expected number", 3 )
elseif tHex[color] == nil then
error( "Invalid color", 3 )
end
nTextColor = color nTextColor = color
if bVisible then if bVisible then
updateCursorColor() updateCursorColor()
@ -312,6 +317,11 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
window.getPaletteColor = window.getPaletteColour window.getPaletteColor = window.getPaletteColour
local function setBackgroundColor( color ) local function setBackgroundColor( color )
if type(color) ~= "number" then
error( "Expected number", 3 )
elseif tHex[color] == nil then
error( "Invalid color", 3 )
end
nBackgroundColor = color nBackgroundColor = color
end end