These are chat archives for ChaiScript/ChaiScript

23rd
Mar 2016
Jason Turner
@lefticus
Mar 23 2016 00:14
in your script you could do global print = someotherprintfunction
then any call to print() would find your version first
is that what you need?
Jason Turner
@lefticus
Mar 23 2016 15:15
My personal choice would be to do a combination, to take advantage of automatic string conversions inside of chaiscript:
// c++
void handle_output(const std::string &t_str) {
  // do someting with t_str, redirect to console or whatever
}

int main() {
  // make chaiscript, watever
  chai.add(chaiscript::fun(&handle_output), "handle_output");
}
//chaiscript
global print = fun(x){ handle_output(to_string(x)); }