Search code examples
.netscriptingembeddingscripting-language

Scripting language for .net which supports yield and saving the state of the vm


Is there an embeddable scripting language for .Net which supports some kind of yield (program stops and yields control back to host... With next run it continues where it left off)?

Furthermore it should be possible to save the state of the vm, and let it continue at some later point.

Edit1: I've looked at lua, and while one can access the globals from c#, the whole method to do it feels hacky.

Edit2: I'm also looking at ironruby and it seems one can query and set global variables, but not get all of them in one go.


Solution

  • Write it in VB or C#, with a well-defined tree of classes that hold all your state. This tree will consist of a root class, with all your data in lists etc., that are serialisable.

    At an appropriate point, XML-serialise everything out to a stream file.

    On re-start, de-serialise from the saved file and start where you left off.