#include #include int main() { // We cannot deduce the type of a lambda expression, you must either wrap it // in an std::function or provide the signature chaiscript::ChaiScript chai(chaiscript::Std_Lib::library()); // provide the signature chai.add(chaiscript::fun([] { return "hello"; } ), "f1"); // wrap chai.add(chaiscript::fun(std::function([] { return "world"; } )), "f2"); if (chai.eval("f1()") == "hello" && chai.eval("f2()") == "world") { return EXIT_SUCCESS; } else { return EXIT_FAILURE; } }