Documentation
¶
Index ¶
- type Engine
- type Module
- type ModuleRegistry
- func (r *ModuleRegistry) Clear()
- func (r *ModuleRegistry) Count() int
- func (r *ModuleRegistry) GetModule(name string) (Module, bool)
- func (r *ModuleRegistry) GetModules() map[string]Module
- func (r *ModuleRegistry) ListModules() []string
- func (r *ModuleRegistry) RegisterModule(m Module)
- func (r *ModuleRegistry) RegisterModules(modules []Module)
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 (*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 批量注册模块
Click to show internal directories.
Click to hide internal directories.