These are chat archives for ChaiScript/ChaiScript

Jan 2017
Raoul Wols
Jan 13 2017 20:15
hello everyone!
so i'm considering chaiscript as an embedded scripting aln
Raoul Wols
Jan 13 2017 20:23

there's one thing which I cannot find anything in the docs about though, and it's this:
suppose I have a chai file and a chaiscript::ChaiScript object in C++, and suppose I want to load the chai file into the chaiscript::ChaiScript object, then later, call some functions from the C++-side defined in the chai file.

1) Is this possible?
2) If so, does state get preserved between calls?
For instance, if I define a global global i = 0; in a chai file and a chai function that increments that value, can I at a later point in time retrieve that global from the chai file and read it on the C++-side?

Raoul Wols
Jan 13 2017 20:42
I think my use case is somewhat similar to ChaiScript/ChaiScript#216
So yeah, suppose I define some functions in a chai file, then say chaiscript.use("my file.chai"), is it as straightforward as calling chaiscript.eval("foo();") if I want to call the chai function foo a bunch of times?