Best way to debug lua
-
- Burner Inserter
- Posts: 12
- Joined: Wed Mar 01, 2017 4:23 pm
- Contact:
Best way to debug lua
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
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
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