Very happy with changes that help you with save game issues

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Very happy with changes that help you with save game issues

Post by MrChoke »

My number one complaint with modding Grimrock 2 has been fixed in the latest beta. I cannot tell you how many hours I have spent doing trial and error commenting out of code, export, save game in custom dungeon - GAME BLOWS UP, restart editor..... And do it over and over again trying to find what mistake I made in my LUA code.

I know the patch notes talked about improvements to showing errors. It sure has improved. I found my problem in 5 minutes. Example of the new error we get:

Code: Select all

forest_exit_ft_22: cannot serialize function with upvalues
stack traceback:
	[C]: in function 'error'
	[string "Script.lua"]: in function 'saveValue'
	[string "Script.lua"]: in function 'saveValue'
	[string "Script.lua"]: in function 'saveValue'
	[string "Script.lua"]: in function 'saveState'
	[string "GameObject.lua"]: in function 'saveState'
	[string "Map.lua"]: in function 'saveState'
	[string "GameMode.lua"]: in function 'saveGame'
	[string "SaveGameMenu.lua"]: in function 'update'
	[string "GameMode.lua"]: in function 'update'
	[string "Grimrock.lua"]: in function 'display'
	[string "Grimrock.lua"]: in main chunk
I immediately knew 1) the game object that couldn't serialize, and 2) the reason why. In LUA, another name for an "upvalue" is an "external local variable". This is my typical mistake because my IDE doesn't help me see when I am using a local variable inside a function that I then attach to a game object.

Anyway, thanks AH. This change is great.
Post Reply