From e78dcdf21b65bc75d76b4d4005d9516551a82a0d Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 13 Jan 2019 12:07:19 +0100 Subject: [PATCH] Experimental chaiscript --- src/module/scripting.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/module/scripting.cpp b/src/module/scripting.cpp index 067d55c..7b0d5b3 100644 --- a/src/module/scripting.cpp +++ b/src/module/scripting.cpp @@ -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("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)