Experimental chaiscript
This commit is contained in:
parent
065363fdbf
commit
e78dcdf21b
@ -7,8 +7,20 @@ class scripting final : public module
|
||||
public:
|
||||
void post_load() override
|
||||
{
|
||||
|
||||
this->chai_.add(chaiscript::fun(&function), "function");
|
||||
|
||||
double d = this->chai_.eval<double>("function(3, 4.75);");
|
||||
printf("Result: %f", d);
|
||||
}
|
||||
|
||||
private:
|
||||
chaiscript::ChaiScript chai_;
|
||||
|
||||
static double function(int i, double j)
|
||||
{
|
||||
return i * j;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_MODULE(scripting)
|
||||
|
Loading…
Reference in New Issue
Block a user