Best way to debug lua

Place to get help with not working mods / modding interface.
blitz_skull
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Mar 01, 2017 4:23 pm
Contact:

Best way to debug lua

Post 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!
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Best way to debug lua

Post 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
Post Reply

Return to “Modding help”