Page 1 of 1

[Rseding91] [1.0.0] Savefile corrupts if invalid LuaItemStack is in global table

Posted: Thu Sep 10, 2020 5:14 am
by x2605
corrupt_save_test.zip
(834 Bytes) Downloaded 128 times
I was playing with events, I tried to log every events in global table.
I found a case that allows save without warning but making cannot load the save again.

Reproduce :
- Download scenario and upzip in scenario folder to play it.
- It's writing some LuaObjects caught in event, in global table. Currently only LuaItemStack is written.
- Place a wooden-chest and save it. (Will cause on_built_entity having stack = LuaItemStack as temporary object)
- Try to load it.

Re: [1.0.0] Savefile corrupts if invalid LuaItemStack is in global table

Posted: Thu Sep 10, 2020 5:39 am
by Rseding91
Thanks for the report. It's now fixed for the next release. The issue is trying to save the temporary stack given during the on-built-entity event; it's invalid after the event finishes so saving it in global serves no purpose. It's not supposed to crash but that's what is causing it for you.