Original Post
Hello
I have integrated lua with my game. Everything works fine, but I can't find any easy way to keep persistent data in the scripts, ie: data that can be stored to/retrieved from a save file.
In the worst case I could of course register some functions like Set/GetVariable(name, value) and store the variables as strings engine-side, but that would make the scripts more difficult to maintain, not to mention ugly :).
Ideally what I would like to save is the global variables of my lua context. Does anyone know how this can be done using the lua C API?
Thank you
Michael
I have integrated lua with my game. Everything works fine, but I can't find any easy way to keep persistent data in the scripts, ie: data that can be stored to/retrieved from a save file.
In the worst case I could of course register some functions like Set/GetVariable(name, value) and store the variables as strings engine-side, but that would make the scripts more difficult to maintain, not to mention ugly :).
Ideally what I would like to save is the global variables of my lua context. Does anyone know how this can be done using the lua C API?
Thank you
Michael