Skip to content

Instantly share code, notes, and snippets.

@bagobor
Last active September 3, 2015 09:30
Show Gist options
  • Save bagobor/885c2aa3cf5a93735b09 to your computer and use it in GitHub Desktop.
Save bagobor/885c2aa3cf5a93735b09 to your computer and use it in GitHub Desktop.
chaiscript test
#include <chaiscript/chaiscript.hpp>
#include <chaiscript/chaiscript_stdlib.hpp>
bool test(int* data) {
int &i = *data;
i = i + 2;
return true;
}
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
chai.add(chaiscript::fun(&test), "test");
chai.eval("def greet(x){var i = 1; test(i);print(i.to_string())};greet(5);");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment