Community Forum

Reload/Reinitialize LUA script within game

Forum Overview >> Scripting

Created20.12.2018 21:53

Nick Silvester (Nicksil) 20.12.2018 21:53

I'm trying to find out if a method exists to reload or re-initialize a LUA script (inside of a mod .zip) while the game is running. Currently, if I make any changes to my mod's LUA script(s), I shut down and restart the program to have those changes take effect. While it's doable, I'd like to save the time of a complete restart if at all possible.

Researching the topic yielded these results so far:

* Farming Simulator 09: "Reload lua file without restarting the game" (

Here, "Christian Ammann" suggests to use the console command `reloadAll`, but it seems this command no longer exists for FS19.

* Farming Simulator 15 (presumed): "Reload mod without restarting the game" (

Here, "theSeb" suggests the use of console command `gsVehicleReloadFromXml`, but as is the same with the previous, this command seems to no longer exist for FS19.

Finally, after cycling through the available commands using <TAB> within FS19's console, no available command really jumped out at me for being the one to use for this case. I tried `gsReloadEnvironment` but, whatever it did, any modifications to my mod's LUA script were not reloaded.

Thanks for your time and any assistance.

Joachim Damm (jodamm) 20.12.2018 23:56
When I try my lua scripts, I don't zip the mod. And for testing the changes I don't quit the program, only the current savegame. I have my test savegame on slot 1 so I only have to press 3 times enter. The loading time is a bit annoying, but the scripts often require the reload of the map anyway.

Nick Silvester (Nicksil) 21.12.2018 04:46
Joachim Damm,

I had no idea I could place my mod in the mod folder as just a folder itself. I guess I just thought I was required to create an archive .zip first. Thanks a lot for this new information; this certainly helps with things.

Jos Kuijpers (Unknown) 02.01.2019 15:49
gsReloadVehicle is available with cheats enabled to reload a vehicle.

Reloading LUA is not currently supported in the game, and to my knowledge has never been in Farming Simulator. Script changes requires reloading of the game.
You can probably add such console command yourself for your mod by adding a console command that runs source() on your files.
But note that instantiations won't work and you can't assume anything anymore about the state of your mod.

For quicker testing, run with -cheats and -autoStartSavegameId 1 (to start savegame 1 directly) on your program arguments.

Nick Silvester (Nicksil) 03.01.2019 00:21
Jos Kuijpers,

This is good information -- especially the program flags -- thanks very much.

Note: Log in to post. Create a new account here.