Merge pull request #235 from hydroflame/improve-get-script-ram

getScriptRam now optionally take hostname/ip or default to localhost
This commit is contained in:
danielyxie
2018-05-09 02:09:28 -05:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@ -788,10 +788,10 @@ getScriptName
getScriptRam
^^^^^^^^^^^^
.. js:function:: getScriptRam(scriptname, hostname/ip)
.. js:function:: getScriptRam(scriptname[, hostname/ip])
:param string scriptname: Filename of script. This is case-sensitive.
:param string hostname/ip: Hostname or IP of target server
:param string hostname/ip: Hostname or IP of target server the script is located on. This is optional, If it is not specified then the function will se the current server as the target server.
Returns the amount of RAM required to run the specified script on the target server

View File

@ -2006,7 +2006,7 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {return 0;}
return workerScript.name;
},
getScriptRam : function (scriptname, ip) {
getScriptRam : function (scriptname, ip=workerScript.serverIp)
if (workerScript.checkingRam) {
if (workerScript.loadedFns.getScriptRam) {
return 0;