From af0549946b77b746b2d2d01a0c474cf94246bf0c Mon Sep 17 00:00:00 2001 From: CrazedProgrammer Date: Sat, 15 Jul 2017 00:17:34 +0200 Subject: [PATCH] Fix window API argument check made in PR #304 - Fix window.reposition so the new width and height arguments are optional --- .../resources/assets/computercraft/lua/rom/apis/window.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/computercraft/lua/rom/apis/window.lua b/src/main/resources/assets/computercraft/lua/rom/apis/window.lua index eaac77eae..4edd393b5 100644 --- a/src/main/resources/assets/computercraft/lua/rom/apis/window.lua +++ b/src/main/resources/assets/computercraft/lua/rom/apis/window.lua @@ -413,8 +413,8 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible ) function window.reposition( nNewX, nNewY, nNewWidth, nNewHeight ) if type( nNewX ) ~= "number" then error( "bad argument #1 (expected number, got " .. type( nNewX ) .. ")", 2 ) end if type( nNewY ) ~= "number" then error( "bad argument #2 (expected number, got " .. type( nNewY ) .. ")", 2 ) end - if type( nNewWidth ) ~= "number" then error( "bad argument #3 (expected number, got " .. type( nNewWidth ) .. ")", 2 ) end - if type( nNewHeight ) ~= "number" then error( "bad argument #4 (expected number, got " .. type( nNewHeight ) .. ")", 2 ) end + if nNewWidth ~= nil and type( nNewWidth ) ~= "number" then error( "bad argument #3 (expected number, got " .. type( nNewWidth ) .. ")", 2 ) end + if nNewHeight ~= nil and type( nNewHeight ) ~= "number" then error( "bad argument #4 (expected number, got " .. type( nNewHeight ) .. ")", 2 ) end nX = nNewX nY = nNewY