Browse Source

Better help for missing commmand args

main
chksm 2 years ago
parent
commit
b08ad22b92
  1. 16
      script/commands.lua

16
script/commands.lua

@ -33,16 +33,31 @@ commands.add_command("stat", "Used to control metrics in Statorio mod\n[add|list
elseif argsArr[1] == "add" then
if not argsArr[2] then
player.print("Adding requires a metric")
return
end
table.insert(global.statorio.metrics, argsArr[2])
player.print("Added metric ["..table_size(global.statorio.metrics).."]")
elseif argsArr[1] == "del" then
if not argsArr[2] then
player.print("Deleting requires the index number of a metric from the list command")
return
end
table.remove(global.statorio.metrics, argsArr[2])
player.print("Removed metric ["..argsArr[2].."]")
elseif argsArr[1] == "test" then
if not argsArr[2] then
player.print("Testing requires a metric")
return
end
if not Fetcher.traverseApiForValues(argsArr[2], function(name, val)
player.print(name..": "..safeString(val))
end)
@ -53,5 +68,6 @@ commands.add_command("stat", "Used to control metrics in Statorio mod\n[add|list
else
player.print("Try list, add, del or test. For example:\n/stat list")
player.print("For more information see https://mods.factorio.com/mod/statorio")
end
end)
Loading…
Cancel
Save