How do I accept commands with arguments?
Posted: Wed Jun 28, 2017 11:49 am
I'm trying to have my mod accept console commands with arguments. Here's what I'm using:
The command is entered like:
However global.tickRate is set to nil. I thought the table named list would contain the arguments I passed, but it doesn't. How do I accept arguments with a console command?
Code: Select all
commands.add_command("setTickRate","Sets how often the mod should scan for things. (default: 20)",
function(list)
global.tickRate = list[1]
game.player.print(global.tickRate)
end
)
Code: Select all
/setTickRate 50