Last active
February 10, 2017 08:28
-
-
Save lefticus/9456197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chaiscript/chaiscript.hpp> | |
#include <chaiscript/chaiscript_stdlib.hpp> | |
std::string helloWorld(const std::string &t_name) | |
{ | |
return "Hello " + t_name + "!"; | |
} | |
int main() | |
{ | |
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library()); | |
chai.add(chaiscript::fun(&helloWorld), "helloWorld"); | |
chai.eval("puts(helloWorld(\"Bob\"));"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like this example need to be updated... The latest version of ChaiScript doesn't work with this usage. I think you'd need to replace
ChaiScript
withChaiScript_Basic
, in order for the first argument to still be the Std_Lib::library() (e.g. if you want to compile the standard library in a separate file). It seems you've changed the default ChaiScript constructor to create Std_Lib by default, rather than searching for an external library at runtime, as mentioned here.