script

package
v0.0.0-...-796ed42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScriptRunner

type ScriptRunner struct {
	OnPlayerCreated func(entry *donburi.Entry)
	// contains filtered or unexported fields
}

ScriptRunner manages the Lua scripting engine for the playground mode. It wraps a gopher-lua LState and provides access to the ECS world for the Lua API bindings.

var ActiveRunner *ScriptRunner

ActiveRunner is the currently active ScriptRunner. It is set by the scene when entering script-capable modes and can be accessed by the UI layer.

func NewScriptRunner

func NewScriptRunner(ecs *ecs.ECS) *ScriptRunner

NewScriptRunner creates a new ScriptRunner with the given ECS. It initializes the Lua VM, registers the "ff" module and all user-defined types. Also sets itself as the ActiveRunner.

func (*ScriptRunner) Close

func (sr *ScriptRunner) Close()

Close releases the Lua VM resources.

func (*ScriptRunner) ECS

func (sr *ScriptRunner) ECS() *ecs.ECS

ECS returns the ECS world associated with this ScriptRunner.

func (*ScriptRunner) Run

func (sr *ScriptRunner) Run(script string)

Run executes a Lua script string in a goroutine. Scripts run asynchronously to avoid blocking the game loop.

func (*ScriptRunner) RunFile

func (sr *ScriptRunner) RunFile(path string)

RunFile loads and executes a Lua script file in a goroutine.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL