Merge pull request #606 from SirNate0/patch-1

Fix cheatsheet.md typos
This commit is contained in:
Rob Loach 2023-02-21 12:03:56 -05:00 committed by GitHub
commit 3e548184c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,7 +155,7 @@ This allows you to pass a ChaiScript function to a function requiring `std::vect
```
chai.add(chaiscript::var(somevar), "somevar"); // copied in
chai.add(chaiscript::var(std::ref(somevar), "somevar"); // by reference, shared between C++ and chai
chai.add(chaiscript::var(std::ref(somevar)), "somevar"); // by reference, shared between C++ and chai
auto shareddouble = std::make_shared<double>(4.3);
chai.add(chaiscript::var(shareddouble), "shareddouble"); // by shared_ptr, shared between c++ and chai
chai.add(chaiscript::const_var(somevar), "somevar"); // copied in and made const
@ -301,7 +301,7 @@ p(5); // calls chaiscript's 'to_string' function, returning std::string("5")
Note: backtick treats operators as normal functions
```cpp
auto p = chai.eval<std::function<int (int, int)>>(`+`);
auto p = chai.eval<std::function<int (int, int)>>("`+`");
p(5, 6); // calls chaiscript's '+' function, returning 11
```