mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Fix one more documentation error
This commit is contained in:
parent
8cc3651c76
commit
9e9fb3ad7d
@ -25,7 +25,7 @@ Once instantiated, the engine is ready to start running ChaiScript source. You
|
|||||||
|
|
||||||
To make functions in your C++ code visible to scripts, they must be registered with the scripting engine. To do so, call add:
|
To make functions in your C++ code visible to scripts, they must be registered with the scripting engine. To do so, call add:
|
||||||
|
|
||||||
chai.add(&my_function, "my_function_name");
|
chai.add(chaiscript::fun(&my_function), "my_function_name");
|
||||||
|
|
||||||
Once registered the function will be visible to scripts as "my_function_name"
|
Once registered the function will be visible to scripts as "my_function_name"
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ double function(int i, double j)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai;
|
||||||
chai.add(&function, "function");
|
chai.add(chaiscript::fun(&function), "function");
|
||||||
|
|
||||||
double d = chai.eval<double>("function(3, 4.75);");
|
double d = chai.eval<double>("function(3, 4.75);");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user