model

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// GetState 获取 Lua 状态机
	GetState() *lua.LState

	// RegisterMethod 注册方法
	RegisterMethod(name, description string, fn interface{}, overridable bool)
}

Engine 引擎接口

type Module

type Module interface {
	// Name 返回模块名称
	Name() string

	// Register 向引擎注册模块的方法
	// 返回错误:如果注册失败(如 Cgo 模块在非 Android 平台)
	Register(engine Engine) error

	// IsAvailable 返回模块是否可用(用于检查依赖)
	IsAvailable() bool
}

Module 模块接口,所有注入模块都需要实现此接口

type ModuleRegistry

type ModuleRegistry struct {
	// contains filtered or unexported fields
}

ModuleRegistry 模块注册表

func NewModuleRegistry

func NewModuleRegistry() *ModuleRegistry

NewModuleRegistry 创建新的模块注册表

func (*ModuleRegistry) Clear

func (r *ModuleRegistry) Clear()

Clear 清空所有模块

func (*ModuleRegistry) Count

func (r *ModuleRegistry) Count() int

Count 返回模块数量

func (*ModuleRegistry) GetModule

func (r *ModuleRegistry) GetModule(name string) (Module, bool)

GetModule 获取模块

func (*ModuleRegistry) GetModules

func (r *ModuleRegistry) GetModules() map[string]Module

GetModules 获取所有模块对象

func (*ModuleRegistry) ListModules

func (r *ModuleRegistry) ListModules() []string

ListModules 列出所有模块

func (*ModuleRegistry) RegisterModule

func (r *ModuleRegistry) RegisterModule(m Module)

RegisterModule 注册模块

func (*ModuleRegistry) RegisterModules

func (r *ModuleRegistry) RegisterModules(modules []Module)

RegisterModules 批量注册模块

Jump to

Keyboard shortcuts

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