I'm starting to learn chaiscript and couldn't find this in the documentation.
I know there is API to evaluate a chaiscript file from C++ by calling ChaiScript::eval_file
But is it possible to do the same from a chaiscript file?
I'm starting to learn chaiscript and couldn't find this in the documentation.
I know there is API to evaluate a chaiscript file from C++ by calling ChaiScript::eval_file
But is it possible to do the same from a chaiscript file?
From within ChaiScript the use
function is available, but the eval_file
is not. use
only loads a file if it has not already been loaded. eval_file
loads the file regardless.
use("use.inc")
assert_equal("hello", greet())
// Include it a second time and see if there are any errors
use("use.inc")
assert_equal("hello", greet())
From here: https://github.com/ChaiScript/ChaiScript/blob/master/unittests/use.chai
Documentation of the C++ implementation of this function is here: http://chaiscript.com/docs/5/classchaiscript_1_1_chai_script.html#a9fc2eaf37274d09d1ee90ffd411e665c
I don't see any documentation specifying that it's also exposed to the ChaiScript runtime, but you can see many of the functions that are exposed here: https://github.com/ChaiScript/ChaiScript/blob/master/include/chaiscript/language/chaiscript_engine.hpp#L318