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) 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.