mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-08 02:36:49 +08:00
16 lines
321 B
C++
16 lines
321 B
C++
#include <chaiscript/chaiscript.hpp>
|
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
|
|
|
double function(int i, double j)
|
|
{
|
|
return i * j;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
chaiscript::ChaiScript chai(chaiscript::Std_Lib::library());
|
|
chai.add(chaiscript::fun(&function), "function");
|
|
|
|
double d = chai.eval<double>("function(3, 4.75);");
|
|
}
|