pocketpy/docs/LuaC-API/introduction.md
BLUELOVETH 5f0bf65da7 ...
2023-07-07 16:02:30 +08:00

848 B

title icon order
Introduction dot 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 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.