example for ns2 arguments from terminal

example for ns2 arguments from terminal because args array seems to not be used anymore
This commit is contained in:
marcowesii 2022-06-19 18:59:15 +02:00 committed by GitHub
parent 535812a0fc
commit a4b7f69307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,3 +23,14 @@ into a script using::
args.length args.length
**WARNING: Do not try to modify the args array. This will break the game.** **WARNING: Do not try to modify the args array. This will break the game.**
example for accessing arguments in ns2 from terminal execution:
terminal command:
run name_of_script.js -t 10 --tail argument1 argument2
ns2 script:
const args_obj = arguments[0]
const argument1 = (args_obj.server.args[0])
const argument2 = (args_obj.server.args[1])