[2.0.7] LuaGameScript doesnt contain key write_file

Bugs that are actually features.
arye321
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Oct 06, 2018 6:06 am
Contact:

[2.0.7] LuaGameScript doesnt contain key write_file

Post 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 141 times

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 577
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [2.0.7] LuaGameScript doesnt contain key write_file

Post by raiguard »

This is not a bug, this function has been moved to helpers.

See https://lua-api.factorio.com/latest/cla ... write_file
Don't forget, you're here forever.

arye321
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Oct 06, 2018 6:06 am
Contact:

Re: [2.0.7] LuaGameScript doesnt contain key write_file

Post 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")))

Post Reply

Return to “Not a bug”