blueloveTH d513a3b459 ...
2023-04-23 12:42:42 +08:00

688 B

icon label order
code Godot Engine 2

Introduction

PocketPy for Godot is integrated via GDExtension.

!!! GDExtension is a Godot 4.0 feature. Godot 3.x won't work. !!!

Please see https://github.com/blueloveTH/godot-cpp/tree/master/pocketpy for details.

Example

# main.gd

extends Node

func _ready():
	# Create a virtual machine
	var vm = pkpy.new_vm(false)

	# Run a script
	pkpy.vm_exec(vm, "print('Hello World!')")

	# Read the output
	var _o = pkpy.vm_read_output(vm)

	# Parse the output
	var res = JSON.parse_string(_o)

	# Print the output
	print(res["stdout"])    # "Hello World!\n"