game.print(i, v)
...
error :: RuntimeError: 'color': table expected, got number
Issue is that game.print is not a print(), it's a function for printing to console log for all players with a given color:
https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.print
Signature is game.print(message, color)
, and you passed it a number as a "color" argument, which should be either {r,g,b}
or {r=n, g=n, b=n}
table.
print(i, v)
- that's lua's print() function, which converts all its arguments to strings and prints them with some tab offsets to game's stdout iirc.
I think it's problem, and why it's not advertised in help window (it's base lua, doesn't really need to be), is that such output shouldn't end up in factorio log, only its stdout, which can be hard to get on some platforms or unless you start game in a terminal or something.
Guess there should probably be a wrapper for game.print to avoid confusion, as I think it's nature is not well-explained in help window either atm...
Unrelatedly, I would like it if there was a print out of current environment variables (besides the debug output).
And/or a button to delete current environment variables.
Oh, that's a good idea, probably should be printed in a separate window though, as unlike signals they might have complex free-form values, and there can be a lot of them.
Thanks for suggestion!