Page 1 of 1

LUA Error when using table inside table

Posted: Mon Sep 24, 2012 8:21 pm
by Damien
There is an error when we use table on table.
If the table is as a global variable the game crash when we start it. If he is in a fonction it crash when we save the game.
But when i play into the editor i have no problem, it is only when i export the game and test it.

Memory addressing error ?

Exemple :
skeleton_warrior = { "skeleton_warrior", 120 ,9, 15, 5, 1,1 };
herder_small = { "herder_small", 80 ,10,20, 5, 1,0 };
herder = { "herder", 120 ,10,30, 4, 0,0 };
Monsters = {skeleton_warrior, herder_small,herder }

Error :
main: cannot serialize cyclical tables
stack traceback:
[C]: in function 'error'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "GameMode.lua"]: in function 'autoSave'
[string "GameMode.lua"]: in function 'newGame'
[string "GameMode.lua"]: in function 'startGame'
[string "NewGameMenu.lua"]: in function 'startGame'
[string "NewGameMenu.lua"]: in function 'update'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk

PS : I have release a beta of my mode named "Surivors by Damien", i have to rewrite all without table, saving is not already working..

Re: LUA Error when using table inside table

Posted: Tue Sep 25, 2012 7:02 am
by petri
Tables that refer to other tables are not properly supported by save games at the moment. I guess I have to fix it...