diff --git a/src/main/resources/assets/computercraft/lua/rom/apis/rednet.lua b/src/main/resources/assets/computercraft/lua/rom/apis/rednet.lua index 7dce4b4ce..9c5e2289e 100644 --- a/src/main/resources/assets/computercraft/lua/rom/apis/rednet.lua +++ b/src/main/resources/assets/computercraft/lua/rom/apis/rednet.lua @@ -106,16 +106,16 @@ function broadcast( message, sProtocol ) end function receive( sProtocolFilter, nTimeout ) + -- The parameters used to be ( nTimeout ), detect this case for backwards compatibility + if type(sProtocolFilter) == "number" and nTimeout == nil then + sProtocolFilter, nTimeout = nil, sProtocolFilter + end if sProtocolFilter ~= nil and type( sProtocolFilter ) ~= "string" then error( "bad argument #1 (expected string, got " .. type( sProtocolFilter ) .. ")", 2 ) end if nTimeout ~= nil and type( nTimeoutl ) ~= "number" then error( "bad argument #2 (expected number, got " .. type( nTimeout ) .. ")", 2 ) end - -- The parameters used to be ( nTimeout ), detect this case for backwards compatibility - if type(sProtocolFilter) == "number" and nTimeout == nil then - sProtocolFilter, nTimeout = nil, sProtocolFilter - end -- Start the timer local timer = nil @@ -174,7 +174,7 @@ function lookup( sProtocol, sHostname ) if type( sProtocol ) ~= "string" then error( "bad argument #1 (expected string, got " .. type( sProtocol ) .. ")", 2 ) end - if type( sHostname ) ~= "string" then + if sHostname ~= nil and type( sHostname ) ~= "string" then error( "bad argument #2 (expected string, got " .. type( sHostname ) .. ")", 2 ) end