mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
36 lines
848 B
Markdown
36 lines
848 B
Markdown
---
|
|
title: Introduction
|
|
icon: dot
|
|
order: 10
|
|
---
|
|
|
|
We take a lot of inspiration from the lua api for these bindings.
|
|
The key difference being most methods return a bool,
|
|
true if it succeeded false if it did not.
|
|
|
|
!!!
|
|
Special thanks for [@koltenpearson](https://github.com/koltenpearson) for bringing us the Lua Style API implementation.
|
|
!!!
|
|
|
|
Set option `PK_EXPORT_C_API` to `ON` to enable the C API in cmake build process.
|
|
|
|
## Basic Functions
|
|
|
|
#### `pkpy_vm* pkpy_vm_create(bool use_stdio, bool enable_os)`
|
|
|
|
Creates a new Lua Style VM.
|
|
|
|
+ `use_stdio`: if true, the VM will use stdout and stderr
|
|
+ `enable_os`: if true, the VM will have access to the os library
|
|
|
|
#### `bool pkpy_vm_run(pkpy_vm*, const char* source)`
|
|
|
|
Runs the given source code in the VM.
|
|
|
|
+ `source`: the source code to run
|
|
|
|
#### `void pkpy_vm_destroy(pkpy_vm*)`
|
|
|
|
Destroys the VM.
|
|
|