mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-06 18:20:17 +00:00
Update cheatsheet.md
This commit is contained in:
parent
418f373a1b
commit
e8ad5b5784
@ -117,12 +117,12 @@ Get native types without type checking
|
|||||||
```cpp
|
```cpp
|
||||||
// unsafe version 1 (for int and float you must use `_py_cast`)
|
// unsafe version 1 (for int and float you must use `_py_cast`)
|
||||||
i64 a = _py_cast<i64>(vm, obj);
|
i64 a = _py_cast<i64>(vm, obj);
|
||||||
Str& c = _py_cast<Str&>(vm, obj);
|
f64 b = _py_cast<f64>(vm, obj);
|
||||||
Tuple& e = _py_cast<Tuple&>(vm, obj);
|
Tuple& c = _py_cast<Tuple&>(vm, obj);
|
||||||
// unsafe version 2 (for others, you can use both versions)
|
// unsafe version 2 (for others, you can use both versions)
|
||||||
i64 a_ = PK_OBJ_GET(i64, obj);
|
Str& a_ = PK_OBJ_GET(Str, obj);
|
||||||
Str& c_ = PK_OBJ_GET(Str, obj);
|
List& b_ = PK_OBJ_GET(List, obj);
|
||||||
Tuple& e_ = PK_OBJ_GET(Tuple, obj);
|
Tuple& c_ = PK_OBJ_GET(Tuple, obj);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Access python types
|
## Access python types
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user