Skip to content

Basic Usage

Rohan Singh edited this page Aug 21, 2014 · 4 revisions

In order to run Mond scripts you need two things, the virtual machine state and a compiled script.

var state = new MondState();
var program = MondProgram.Compile("return 1 + 1;");

The program can then be loaded into the state.

var result = state.Load(program);

All values can be converted to a string using its Serialize function.

Console.WriteLine(result.Serialize());

Globals can be accessed with the state's indexer.

state["a"] = 10;

program = MondProgram.Compile("global.b = global.a * global.a;");
state.Load(program);

Console.WriteLine(state["b"].Serialize());

Clone this wiki locally