Page 1 of 1

[2.0.7] LuaGameScript doesnt contain key write_file

Posted: Mon Oct 21, 2024 3:00 pm
by arye321
Hi, to generate map preview with command line I need to extract map_gen_settings.json from the Map exchange string

Code: Select all

/c game.write_file('map.txt', game.table_to_json(game.parse_map_exchange_string("<your exchange string here>")))
this command is from your wiki
https://wiki.factorio.com/Command_line_parameters

When i run this command with my exchange string i get error:

Cannot execute command. Error: LuaGameScript doesnt contain key write_file.
factorio error.png
factorio error.png (590.35 KiB) Viewed 140 times

Re: [2.0.7] LuaGameScript doesnt contain key write_file

Posted: Mon Oct 21, 2024 3:01 pm
by raiguard
This is not a bug, this function has been moved to helpers.

See https://lua-api.factorio.com/latest/cla ... write_file

Re: [2.0.7] LuaGameScript doesnt contain key write_file

Posted: Mon Oct 21, 2024 3:11 pm
by arye321
Thanks, this commands works (changed game. to helpers. ):

Code: Select all

/c helpers.write_file('map.txt', helpers.table_to_json(helpers.parse_map_exchange_string(">>>MAP EXCHANGE STRING")))