While thinking of load/save mechanics for a game using Lua coroutines a quite interesting question has arisen -- can you dump a running Lua state to file completely? Apart from the obvious solutions of dumping the environment two notable problems have arisen -- dumping functions (which I think is easier), and dumping coroutines.
The latter made me wonder, whether it is possible at all to dump a running coroutine for a later resume call. The uses for that would be quite wide -- in the long run it would allow serialization of running tasks and passing them around Erlang style.
Hence the question -- is it possible?
I'm not searching for the (maybe obvious) "no" answer, for it probably is possible at some degree of work required (ergo in the worst case one could try to hack the compiler). I'm interested in how hard it would be...
The PlutoLibrary provides "heavy duty persistence" for Lua. It can serialize and deserialize coroutines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With