Page 1 of 1
Best way to debug lua
Posted: Sat Apr 01, 2017 3:30 am
by blitz_skull
I've read that you can open factorio with a console and have the debug logs print there, and I've also read that you can use serpent's pretty printer to print tables. I've got the console open but the lua doesn't seem to print there. Furthermore, I can't figure out how to print tables using the serpent pretty printer. Any help would be greatly appreciated!
Re: Best way to debug lua
Posted: Sat Apr 01, 2017 7:03 am
by Nexela
log() will print to the factorio-current log file.
print() will print to the console
game.write_file("name", contents) will write to the name file in factorio/script-output folder (only available from runtime (control) stage)
local some_table = {"a", "b", "c")
print(serpent.block(some_table)) -- Prints the table out with with table ID's
print(serpent.block(some_table, {comment=false})) -- Prints the table out without table ID's