Experimental chaiscript

This commit is contained in:
momo5502 2019-01-13 12:07:19 +01:00
parent 065363fdbf
commit e78dcdf21b

View File

@ -7,8 +7,20 @@ class scripting final : public module
public: public:
void post_load() override 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) REGISTER_MODULE(scripting)