mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-07 18:26:49 +08:00
Another cheatsheet.md namespace update
This commit is contained in:
parent
9f1ba21c5e
commit
08abf41dfb
@ -128,14 +128,12 @@ math["sin"] = chaiscript::var(chaiscript::fun([](const double x) { return sin(x)
|
|||||||
chai.register_namespace(math, "math");
|
chai.register_namespace(math, "math");
|
||||||
```
|
```
|
||||||
|
|
||||||
Namespaces are imported to make them available for scripting
|
Import namespace via C++ (_not generally recommended_)
|
||||||
|
|
||||||
Importing via C++ (_not generally recommended_)
|
|
||||||
```
|
```
|
||||||
chai.import("math");
|
chai.import("math");
|
||||||
```
|
```
|
||||||
|
|
||||||
Importing via ChaiScript (recommended)
|
Import namespace via ChaiScript (_recommended_)
|
||||||
```
|
```
|
||||||
import("math")
|
import("math")
|
||||||
print(math.pi) // prints 3.14159
|
print(math.pi) // prints 3.14159
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user