Skip to content

Instantly share code, notes, and snippets.

@marty1885
Last active January 14, 2017 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marty1885/cd2cd992915fcad511df71a3419ae49b to your computer and use it in GitHub Desktop.
Save marty1885/cd2cd992915fcad511df71a3419ae49b to your computer and use it in GitHub Desktop.
#include <chaiscript/chaiscript.hpp>
int main()
{
chaiscript::ChaiScript chai;
//Do all the common initialization for you script here
/*
...
*/
//Save the current state of the ChaiScript interpolator
auto state = chai.get_state();
//load main.chai
chai.use("main.chai");
chai.eval("foo();");//foo() from main.chai
//Reset the state of the interpolator to the previous one
chai.set_state(state);
//Load main2.chai
chai.use("main2.chai");
chai.eval("foo();");//foo() from main2.chai
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment