mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Fix spelling mistakes in cheatsheet.md
This commit is contained in:
parent
866ef314a8
commit
dbd2050eb2
@ -48,7 +48,7 @@ chai.add(chaiscript::fun<ReturnType (ParamType1, ParamType2)>(&function_with_ove
|
|||||||
```cpp
|
```cpp
|
||||||
chai.add(chaiscript::fun(static_cast<ReturnType (*)(ParamType1, ParamType2)>(&function_with_overloads)), "function_name");
|
chai.add(chaiscript::fun(static_cast<ReturnType (*)(ParamType1, ParamType2)>(&function_with_overloads)), "function_name");
|
||||||
```
|
```
|
||||||
This overload technique is also used when exposing base member using derived type
|
This overload technique is also used when exposing base members using derived type
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
struct Base
|
struct Base
|
||||||
@ -90,7 +90,7 @@ chai.add(chaiscript::user_type<MyClass>(), "MyClass");
|
|||||||
|
|
||||||
## Adding Type Conversions
|
## Adding Type Conversions
|
||||||
|
|
||||||
User defined type conversions are possible, defined in either script or in C++.
|
User-defined type conversions are possible, defined in either script or in C++.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ Invoking a C++ type conversion possible with `static_cast`
|
|||||||
chai.add(chaiscript::type_conversion<T, bool>());
|
chai.add(chaiscript::type_conversion<T, bool>());
|
||||||
```
|
```
|
||||||
|
|
||||||
Calling a user defined type conversion that takes a lambda
|
Calling a user-defined type conversion that takes a lambda
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
chai.add(chaiscript::type_conversion<TestBaseType, Type2>([](const TestBaseType &t_bt) { /* return converted thing */ }));
|
chai.add(chaiscript::type_conversion<TestBaseType, Type2>([](const TestBaseType &t_bt) { /* return converted thing */ }));
|
||||||
@ -183,7 +183,7 @@ print(math.pi) // prints 3.14159
|
|||||||
```
|
```
|
||||||
|
|
||||||
# Using STL
|
# Using STL
|
||||||
ChaiScript recognize many types from STL, but you have to add specific instantiation yourself.
|
ChaiScript recognizes many types from STL, but you have to add specific instantiation yourself.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
typedef std::vector<std::pair<int, std::string>> data_list;
|
typedef std::vector<std::pair<int, std::string>> data_list;
|
||||||
@ -286,7 +286,7 @@ try {
|
|||||||
} catch (float) {
|
} catch (float) {
|
||||||
} catch (const std::string &) {
|
} catch (const std::string &) {
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
// This is the one what will be called in the specific throw() above
|
// This is the one that will be called in the specific throw() above
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -388,9 +388,9 @@ switch (myvalue) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Built in Types
|
## Built-in Types
|
||||||
|
|
||||||
There are a number of build-in types that are part of ChaiScript.
|
There are a number of built-in types that are part of ChaiScript.
|
||||||
|
|
||||||
### Vectors and Maps
|
### Vectors and Maps
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ on your platform.
|
|||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
Note that any type of ChaiScript function can be passed freely to C++ and automatically
|
Note that any type of ChaiScript function can be passed freely to C++ and automatically
|
||||||
converted into an `std::function` object.
|
converted into a `std::function` object.
|
||||||
|
|
||||||
### General
|
### General
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ If both a 2 parameter and a 3 parameter signature match, the 3 parameter functio
|
|||||||
* `__FUNC__` Name of current function
|
* `__FUNC__` Name of current function
|
||||||
|
|
||||||
|
|
||||||
# Built In Functions
|
# Built-in Functions
|
||||||
|
|
||||||
## Evaluation
|
## Evaluation
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user