lua

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package lua provides the Lua runtime and hot-loading support. CRC: crc-LuaHotLoader.md Spec: deployment.md, module-tracking.md Sequence: seq-lua-hotload.md, seq-unload-module.md

CRC: crc-LuaResolver.md Spec: libraries.md Sequence: seq-lua-resolve.md

CRC: crc-LuaSession.md, crc-LuaRuntime.md (alias), crc-LuaVariable.md, crc-Module.md Spec: interfaces.md, deployment.md, libraries.md, protocol.md, module-tracking.md Sequence: seq-lua-executor-init.md, seq-lua-execute.md, seq-lua-handle-action.md, seq-lua-session-init.md, seq-session-create-backend.md, seq-unload-module.md, seq-require-lua-file.md

LuaSession provides per-session Lua isolation. Each frontend session gets its own LuaSession with a separate Lua VM state. Server owns luaSessions map and creates sessions via callbacks from SessionManager.

Package lua provides ViewList wrapper for array value transformation. CRC: crc-ViewList.md, crc-Wrapper.md Spec: viewdefs.md, protocol.md Sequence: seq-viewlist-presenter-sync.md, seq-wrapper-transform.md

Package lua provides ViewListItem type for ViewList array elements. CRC: crc-ViewListItem.md Spec: viewdefs.md Sequence: seq-viewlist-presenter-sync.md, seq-wrapper-transform.md

Package lua provides wrapper support for variable value transformation. CRC: crc-Wrapper.md, crc-Variable.md Spec: protocol.md Sequence: seq-wrapper-transform.md

WrapperRegistry and factory functions for creating wrapper instances. Note: WrapperManager was removed - wrapper functionality is per-session via LuaSession.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeTrackingKey added in v0.11.0

func ComputeTrackingKey(baseDir, absPath string) (string, error)

ComputeTrackingKey computes a baseDir-relative tracking key for a file. Symlinks are resolved to get the actual target path. This is a package-level function used by both LuaSession and HotLoader. CRC: crc-LuaSession.md

func GetType

func GetType(L *lua.LState, obj any) string

func LuaToGo added in v0.9.0

func LuaToGo(val lua.LValue) interface{}

LuaToGo converts a Lua value to Go. Fields prefixed with "_" are skipped (internal/private fields).

func NewViewList

func NewViewList(sess *LuaSession, variable *TrackerVariableAdapter) interface{}

NewViewList creates a new ViewList wrapper for a variable.

func RegisterCreateFactory

func RegisterCreateFactory(typeName string, typ reflect.Type, factory CreateFactory)

RegisterCreateFactory registers a Go create factory globally.

func RegisterWrapperType

func RegisterWrapperType(typeName string, typ reflect.Type, factory WrapperFactory)

RegisterWrapperType registers a Go wrapper factory globally.

func TypeName added in v0.17.0

func TypeName(val any) (reflect.Type, string)

Types

type CreateFactory

type CreateFactory func(session *LuaSession, value interface{}) interface{}

CreateFactory creates a new object instance from a value.

func GetGlobalCreateFactory

func GetGlobalCreateFactory(typeName string) (CreateFactory, bool)

GetGlobalCreateFactory retrieves a globally registered create factory.

type HotLoader added in v0.9.0

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

HotLoader watches the lua directory for file changes and reloads modified files. CRC: crc-LuaHotLoader.md

func NewHotLoader added in v0.9.0

func NewHotLoader(cfg *config.Config, luaDir string, getSessions func() []*LuaSession, triggerRefresh func(sessionID string)) (*HotLoader, error)

NewHotLoader creates a new hot loader for the given lua directory. triggerRefresh is called after successful reload to run AfterBatch and push changes to browser.

func (*HotLoader) CleanupDirectory added in v0.15.0

func (h *HotLoader) CleanupDirectory(dirPath string)

CleanupDirectory removes tracking state for all files in a directory. Called when a directory is unloaded via session:unloadDirectory(). Seq: seq-unload-module.md

func (*HotLoader) CleanupModule added in v0.15.0

func (h *HotLoader) CleanupModule(trackingKey string)

CleanupModule removes tracking state for a module file. Called when a module is unloaded via session:unloadModule(). Seq: seq-unload-module.md

func (*HotLoader) Start added in v0.9.0

func (h *HotLoader) Start() error

Start begins watching for file changes. Watches lua/ directory and apps/ directory for changes. CRC: crc-LuaHotLoader.md

func (*HotLoader) Stop added in v0.9.0

func (h *HotLoader) Stop() error

Stop stops the hot loader.

type ItemWrapperInstance

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

ItemWrapperInstance represents a created item wrapper (presenter).

type LuaResolver

type LuaResolver struct {
	Session *LuaSession
}

LuaResolver implements changetracker.Resolver for Lua tables and Go wrappers. It navigates Lua tables using GetField/RawGetInt and converts values appropriately.

func (*LuaResolver) Call

func (r *LuaResolver) Call(obj any, methodName string) (any, error)

Call invokes a zero-argument method on a Lua table and returns the result. Used for computed getters like compute().

func (*LuaResolver) CallWith

func (r *LuaResolver) CallWith(obj any, methodName string, value any) error

CallWith invokes a one-argument method on a Lua table with the given value. Used for computed setters like setValue(_).

func (*LuaResolver) ConvertToValueJSON added in v0.9.0

func (r *LuaResolver) ConvertToValueJSON(tracker *changetracker.Tracker, value any) any

ConvertToValueJSON implements the Resolver interface for Lua values. Handles *lua.LTable specially: arrays become []any, objects become ObjectRef.

func (*LuaResolver) CreateValue

func (r *LuaResolver) CreateValue(variable *changetracker.Variable, typ string, value any) any

CreateValue creates a value for the given variable. CRC: crc-LuaResolver.md Spec: protocol.md (Variable Wrappers section)

func (*LuaResolver) CreateWrapper

func (r *LuaResolver) CreateWrapper(variable *changetracker.Variable) any

CreateWrapper creates a wrapper object for the given variable. The wrapper stands in for the variable's value when child variables navigate paths. Returns the existing wrapper if one exists (for wrapper reuse). CRC: crc-LuaResolver.md Spec: protocol.md (Variable Wrappers section)

func (*LuaResolver) Get

func (r *LuaResolver) Get(obj any, pathElement any) (any, error)

Get retrieves a value from an object at the given path element.

func (*LuaResolver) GetType

func (r *LuaResolver) GetType(variable *changetracker.Variable, obj any) string

GetType returns a value's type, given the variable as context. CRC: crc-LuaResolver.md Spec: protocol.md (Variable Wrappers section)

func (*LuaResolver) Set

func (r *LuaResolver) Set(obj any, pathElement any, value any) error

Set assigns a value in a Lua table at the given path element.

type LuaSession

type LuaSession struct {
	// Lua VM state and execution
	State *lua.LState

	// Session identity and state
	ID string // Vended session ID (e.g., "1", "2", "3")

	McpState   *lua.LTable // Logical state root for MCP (defaults to appObject)
	McpStateID int64       // Variable ID of mcpState (if tracked)
	// contains filtered or unexported fields
}

LuaSession represents a Lua runtime environment for a frontend session. Each session has its own Lua state for complete isolation. ID is the vended session ID (compact integer string like "1", "2") for backend communication.

func NewRuntime

func NewRuntime(cfg *config.Config, luaDir string, vdm *viewdef.ViewdefManager) (*LuaSession, error)

NewRuntime creates a new LuaSession with executor goroutine.

func (*LuaSession) AfterBatch added in v0.16.4

func (r *LuaSession) AfterBatch(vendedID string) []VariableUpdate

AfterBatch triggers change detection for a session after processing a message batch. Returns a list of variable updates that need to be sent to the frontend. vendedID is the compact session ID (e.g., "1", "2").

func (*LuaSession) ArrayGet

func (s *LuaSession) ArrayGet(array any, index int) (any, error)

func (*LuaSession) ArrayGetter

func (s *LuaSession) ArrayGetter(array any) (func(int) (any, error), int, error)

func (*LuaSession) BaseDir added in v0.16.4

func (r *LuaSession) BaseDir() string

BaseDir returns the site root directory from config.

func (*LuaSession) CallLuaWrapperMethod added in v0.16.4

func (r *LuaSession) CallLuaWrapperMethod(instance interface{}, method string, args ...interface{}) (interface{}, error)

CallLuaWrapperMethod invokes a method on a Lua wrapper table via executor. Used by LuaWrapper to call computeValue and destroy methods. The instance can be any interface{} but must be a *lua.LTable at runtime.

func (*LuaSession) CallMethod added in v0.16.4

func (r *LuaSession) CallMethod(instance *lua.LTable, method string, args ...interface{}) (interface{}, error)

CallMethod invokes a method on a Lua presenter instance via executor.

func (*LuaSession) ClearCurrentModule added in v0.16.4

func (r *LuaSession) ClearCurrentModule()

ClearCurrentModule clears the current module after load completes.

func (*LuaSession) CreateInstance added in v0.16.4

func (r *LuaSession) CreateInstance(typeName string, props map[string]interface{}) (*lua.LTable, error)

CreateInstance creates a new instance of a presenter type via executor.

func (*LuaSession) CreateItemWrapper added in v0.16.4

func (r *LuaSession) CreateItemWrapper(typeName string, viewItem *ViewListItem) (*ItemWrapperInstance, error)

CreateItemWrapper creates an ItemWrapper instance for a ViewListItem. The ItemWrapper constructor receives the ViewListItem: ItemWrapper(viewListItem). Returns nil if no itemType is specified or the type isn't registered.

func (*LuaSession) CreateLuaSession added in v0.9.0

func (s *LuaSession) CreateLuaSession(vendedID string) (*LuaSession, error)

CreateLuaSession initializes this LuaSession for a frontend session. vendedID is the compact session ID (e.g., "1", "2") for backend communication. Loads and executes main.lua with a session global. Must be called after SetVariableStore. Returns self after initialization.

func (*LuaSession) DestroyLuaSession added in v0.16.4

func (r *LuaSession) DestroyLuaSession(vendedID string)

DestroyLuaSession cleans up a Lua session. Note: The actual Lua state cleanup is handled by Server calling Shutdown().

func (*LuaSession) DirectRequireLuaFile added in v0.16.4

func (r *LuaSession) DirectRequireLuaFile(filename string) (lua.LValue, error)

DirectRequireLuaFile loads a Lua file and tracks it by baseDir-relative path. The filename can be relative to luaDir (e.g., "mcp.lua") or relative to baseDir (e.g., "apps/myapp/init.lua"). Symlinks are resolved to compute the tracking key. CRC: crc-LuaSession.md

func (*LuaSession) ExecuteInSession added in v0.16.4

func (r *LuaSession) ExecuteInSession(sessionID string, fn func() (interface{}, error)) (interface{}, error)

ExecuteInSession executes a function within the context of this session. It sets the global 'session' variable to this session's table before execution. Spec: mcp.md CRC: crc-LuaRuntime.md Sequence: seq-mcp-run.md

func (*LuaSession) GetAppVariableID added in v0.9.0

func (s *LuaSession) GetAppVariableID() int64

GetAppVariableID returns the app variable ID (variable 1) for this session.

func (*LuaSession) GetCurrentModule added in v0.16.4

func (r *LuaSession) GetCurrentModule() *Module

GetCurrentModule returns the module currently being loaded, if any.

func (*LuaSession) GetGlobalTable added in v0.16.4

func (r *LuaSession) GetGlobalTable(name string) interface{}

GetGlobalTable looks up a Lua global by name and returns it if it's a table. Used for auto-discovery of Lua-defined wrappers. Returns nil if the global doesn't exist or isn't a table.

func (*LuaSession) GetLuaSession added in v0.16.4

func (r *LuaSession) GetLuaSession(vendedID string) (*LuaSession, bool)

GetLuaSession returns this session if the vendedID matches. With per-session isolation, each LuaSession IS the session.

func (*LuaSession) GetPresenterType added in v0.16.4

func (r *LuaSession) GetPresenterType(name string) (*PresenterType, bool)

GetPresenterType returns a registered presenter type.

func (*LuaSession) GetTracker

func (s *LuaSession) GetTracker() *changetracker.Tracker

func (*LuaSession) GetValue added in v0.16.4

func (r *LuaSession) GetValue(tbl *lua.LTable, key string) interface{}

GetValue gets a value from a Lua table via executor.

func (*LuaSession) GoToLua added in v0.16.4

func (r *LuaSession) GoToLua(val any) lua.LValue

GoToLua converts a Go value to Lua.

func (*LuaSession) HandleFrontendCreate added in v0.16.4

func (r *LuaSession) HandleFrontendCreate(sessionID string, id int64, parentID int64, properties map[string]string) error

HandleFrontendCreate handles a variable create message from the frontend. For path-based variables, it creates the variable in the tracker and resolves the path. If a wrapper property is set, the tracker automatically creates it via the resolver. Spec: protocol.md - create(id, parentId, value, properties, nowatch?, unbound?) The id is provided by the frontend (frontend-vended IDs). Returns the resolved value (wrapped if applicable) and properties.

func (*LuaSession) HandleFrontendUpdate added in v0.16.4

func (r *LuaSession) HandleFrontendUpdate(sessionID string, varID int64, value json.RawMessage, properties map[string]string) error

HandleFrontendUpdate handles an update to a path-based variable from frontend. Updates the backend object via the variable's path using v.Set(). CRC: crc-LuaRuntime.md Sequence: seq-relay-message.md

func (*LuaSession) IsFileLoaded added in v0.16.4

func (r *LuaSession) IsFileLoaded(trackingKey string) bool

IsFileLoaded checks if a file has been loaded by this session. The trackingKey should be a baseDir-relative path (e.g., "apps/myapp/app.lua"). Used by hot-loader to skip files not yet loaded. CRC: crc-LuaSession.md

func (*LuaSession) ListPresenterTypes added in v0.16.4

func (r *LuaSession) ListPresenterTypes() []string

ListPresenterTypes returns all registered presenter type names.

func (*LuaSession) LoadCode added in v0.16.4

func (r *LuaSession) LoadCode(name, code string) (interface{}, error)

LoadCode loads and executes Lua code string via executor. It returns the result of the execution (if any). After execution, processes any queued prototype mutations. Spec: mcp.md, libraries.md CRC: crc-LuaRuntime.md, crc-LuaSession.md

func (*LuaSession) LoadCodeDirect added in v0.16.4

func (r *LuaSession) LoadCodeDirect(name, code string) (interface{}, error)

LoadCodeDirect executes Lua code without executor wrapping. Use this when already inside ExecuteInSession to avoid deadlock. After execution, processes any queued prototype mutations. MUST only be called from within an execute() context.

func (*LuaSession) LoadFile added in v0.16.4

func (r *LuaSession) LoadFile(filename string) error

LoadFile loads and executes a Lua file via executor (relative to luaDir). Deprecated: Use RequireLuaFile for hot-reload compatible loading.

func (*LuaSession) LoadFileAbsolute added in v0.16.4

func (r *LuaSession) LoadFileAbsolute(path string) error

LoadFileAbsolute loads and executes a Lua file via executor (absolute path). Deprecated: Use RequireLuaFile for hot-reload compatible loading.

func (*LuaSession) Log added in v0.16.4

func (r *LuaSession) Log(level int, format string, args ...interface{})

Log logs a message via the config.

func (*LuaSession) NotifyPropertyChange added in v0.16.4

func (r *LuaSession) NotifyPropertyChange(vendedID string, varID int64, property string, value interface{})

NotifyPropertyChange notifies Lua watchers of a property change for a session. Called by external code when a variable property changes. vendedID is the compact session ID (e.g., "1", "2").

func (*LuaSession) ProcessMutationQueue added in v0.16.4

func (r *LuaSession) ProcessMutationQueue()

ProcessMutationQueue processes queued prototypes after file load. Called after LoadCode completes. Uses executor for thread safety.

func (*LuaSession) RedirectOutput added in v0.16.4

func (r *LuaSession) RedirectOutput(logPath, errPath string) error

RedirectOutput redirects Lua's print function and standard streams to log files. It is used by the MCP server in Configured state. Spec: mcp.md CRC: crc-LuaRuntime.md

func (*LuaSession) RemovePrototype added in v0.16.4

func (r *LuaSession) RemovePrototype(name string, children bool)

RemovePrototype removes a prototype from the registry. If children is true, also removes prototypes whose name starts with "name." (dot-separated children). CRC: crc-LuaSession.md

func (*LuaSession) RequireLuaFile added in v0.16.4

func (r *LuaSession) RequireLuaFile(filename string) error

RequireLuaFile loads a Lua file using the unified load tracker. Skips if already loaded (like require()). Returns error if file not found or execution fails. This is the preferred method for hot-reload compatible file loading.

func (*LuaSession) Set

func (s *LuaSession) Set(varID int64, value any) error

func (*LuaSession) SetCurrentModule added in v0.16.4

func (r *LuaSession) SetCurrentModule(trackingKey, directory string)

SetCurrentModule sets the module being loaded for resource tracking.

func (*LuaSession) SetDeferCallback added in v0.19.0

func (r *LuaSession) SetDeferCallback(cb func(fn func() (interface{}, error)))

SetDeferCallback sets the callback for fire-and-forget async execution. Called by Server during session setup to decouple LuaSession from Server. CRC: crc-LuaSession.md Seq: seq-session-timer.md

func (*LuaSession) SetHotLoaderCleanup added in v0.16.4

func (r *LuaSession) SetHotLoaderCleanup(cleanup func(path string))

SetHotLoaderCleanup sets the callback for cleaning up HotLoader state during unload.

func (*LuaSession) SetMainLuaCode added in v0.16.4

func (r *LuaSession) SetMainLuaCode(code string)

SetMainLuaCode sets the main.lua code to execute for each new session. Used when loading from bundle where filesystem access is not available.

func (*LuaSession) SetReloading added in v0.16.4

func (r *LuaSession) SetReloading(reloading bool)

SetReloading sets the session.reloading flag. Called by hot-loader before/after reloading files.

func (*LuaSession) SetValue added in v0.16.4

func (r *LuaSession) SetValue(tbl *lua.LTable, key string, value interface{})

SetValue sets a value on a Lua table via executor.

func (*LuaSession) SetVariableStore added in v0.16.4

func (r *LuaSession) SetVariableStore(store VariableStore)

SetVariableStore sets the variable store for session operations.

func (*LuaSession) SetWrapperRegistry added in v0.16.4

func (r *LuaSession) SetWrapperRegistry(registry *WrapperRegistry)

SetWrapperRegistry sets the wrapper registry for registering Lua wrappers.

func (*LuaSession) Shutdown added in v0.16.4

func (r *LuaSession) Shutdown()

Shutdown cleans up the Lua VM and stops executor.

func (*LuaSession) TriggerBatch added in v0.16.4

func (r *LuaSession) TriggerBatch()

func (*LuaSession) UnloadDirectory added in v0.16.4

func (r *LuaSession) UnloadDirectory(dirPath string)

UnloadDirectory unloads all modules in a directory and cleans up HotLoader state.

func (*LuaSession) UnloadModule added in v0.16.4

func (r *LuaSession) UnloadModule(moduleName string)

UnloadModule removes all tracking related to a module. This removes prototypes, presenter types, wrappers, and loadedModules entry. It also cleans up HotLoader state via the cleanup callback.

type LuaWrapper

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

LuaWrapper wraps a Lua table as a Go Wrapper interface.

func NewLuaWrapper

func NewLuaWrapper(session *LuaSession, template luaTable, variable *TrackerVariableAdapter) *LuaWrapper

NewLuaWrapper creates a wrapper from a Lua table definition.

func (*LuaWrapper) Value

func (w *LuaWrapper) Value() any

Value returns the wrapped Lua table instance.

type Module added in v0.15.0

type Module struct {
	// Name is the module's tracking key (baseDir-relative file path)
	Name string
	// Directory is the directory containing this module
	Directory string
	// Prototypes tracks prototype names registered by this module
	Prototypes []string
	// PresenterTypes tracks presenter type names registered by this module
	PresenterTypes []string
	// Wrappers tracks wrapper names registered by this module
	Wrappers []string
}

Module tracks resources registered by a single Lua module file. This enables clean unloading by tracking what each module registered.

func NewModule added in v0.15.0

func NewModule(name, directory string) *Module

NewModule creates a new Module with the given tracking key and directory.

func (*Module) AddPresenterType added in v0.15.0

func (m *Module) AddPresenterType(name string)

AddPresenterType tracks a presenter type registered by this module.

func (*Module) AddPrototype added in v0.15.0

func (m *Module) AddPrototype(name string)

AddPrototype tracks a prototype registered by this module.

func (*Module) AddWrapper added in v0.15.0

func (m *Module) AddWrapper(name string)

AddWrapper tracks a wrapper registered by this module.

type PresenterType

type PresenterType struct {
	Name    string
	Methods map[string]*lua.LFunction
	Table   *lua.LTable
}

PresenterType represents a Lua-defined presenter type.

type TrackerVariableAdapter

type TrackerVariableAdapter struct {
	*changetracker.Variable
	Session *LuaSession
}

TrackerVariableAdapter adapts a change-tracker Variable to WrapperVariable interface

func WrapTrackerVariable

func WrapTrackerVariable(session *LuaSession, v *changetracker.Variable) *TrackerVariableAdapter

type VariableStore

type VariableStore interface {
	// Session management - each session has its own tracker
	CreateSession(sessionID string, resolver changetracker.Resolver)
	DestroySession(sessionID string)
	GetTracker(sessionID string) *changetracker.Tracker

	// Variable operations (delegate to session's tracker)
	CreateVariable(sessionID string, parentID int64, luaObject *lua.LTable, properties map[string]string) (int64, error)
	Get(id int64) (value json.RawMessage, properties map[string]string, ok bool)
	GetProperty(id int64, name string) (string, bool)
	Update(id int64, value json.RawMessage, properties map[string]string) error
	Destroy(id int64) error

	// Change detection
	DetectChanges(sessionID string) bool
	GetChanges(sessionID string) []changetracker.Change
}

VariableStore interface for session operations.

type VariableUpdate

type VariableUpdate struct {
	VarID      int64
	Value      json.RawMessage
	Properties map[string]string
}

VariableUpdate represents a detected change to be sent to the frontend.

type ViewList

type ViewList struct {
	Items          []*ViewListItem // The actual list of ViewListItem objects
	SelectionIndex int             // The current selection index
	// contains filtered or unexported fields
}

ViewList transforms an array of domain object refs into ViewListItem refs. It creates ViewListItem objects for each item in the source array.

func (*ViewList) Destroy

func (vl *ViewList) Destroy() error

Destroy cleans up all ViewListItems when the variable is destroyed.

func (*ViewList) SyncViewItems

func (vl *ViewList) SyncViewItems()

SyncViewItems synchronizes the `Items` slice with the `value` slice.

func (*ViewList) Tracker

func (vl *ViewList) Tracker() *changetracker.Tracker

func (*ViewList) Update

func (vl *ViewList) Update(newValue interface{})

Update updates the ViewList with a new raw value from the backend. ArrayGetter in SyncViewItems handles both Go slices and Lua tables.

func (*ViewList) Value

func (vl *ViewList) Value() interface{}

Value returns the list of ViewListItems.

type ViewListItem

type ViewListItem struct {
	Item     any // BaseItem or a wrapper, if ViewList.itemType is set
	BaseItem any // Domain object reference
	List     *ViewList
	Index    int
	// contains filtered or unexported fields
}

ViewListItem represents an element in a ViewList. It provides domain object access (Item), presenter access (Item), list context (List), and position tracking (Index).

func NewViewListItem

func NewViewListItem(item interface{}, list *ViewList, index int) *ViewListItem

NewViewListItem creates a new ViewListItem for a domain object.

func (*ViewListItem) GetBaseItem

func (vli *ViewListItem) GetBaseItem() interface{}

GetItem returns the (possibly wrapped) item reference.

func (*ViewListItem) GetIndex

func (vli *ViewListItem) GetIndex() int

GetIndex returns the position in the list.

func (*ViewListItem) GetItem

func (vli *ViewListItem) GetItem() interface{}

GetItem returns the (possibly wrapped) item reference.

func (*ViewListItem) GetItemObjID

func (vli *ViewListItem) GetItemObjID() int64

func (*ViewListItem) GetList

func (vli *ViewListItem) GetList() *ViewList

GetList returns the owning ViewList.

func (*ViewListItem) GetObjID

func (vli *ViewListItem) GetObjID() int64

func (*ViewListItem) SetIndex

func (vli *ViewListItem) SetIndex(index int)

SetIndex updates the position (called when list reorders).

type WorkItem

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

WorkItem represents a unit of work for the executor.

type WorkResult

type WorkResult struct {
	Value interface{}
	Err   error
}

WorkResult holds the result of a work item.

type WrapperFactory

type WrapperFactory func(session *LuaSession, variable *TrackerVariableAdapter) interface{}

WrapperFactory creates a new wrapper instance for a variable.

func GetGlobalWrapperFactory

func GetGlobalWrapperFactory(typeName string) (WrapperFactory, bool)

GetGlobalWrapperFactory retrieves a globally registered wrapper factory.

type WrapperRegistry

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

WrapperRegistry manages registered wrapper types.

func NewWrapperRegistry

func NewWrapperRegistry() *WrapperRegistry

NewWrapperRegistry creates a new wrapper registry.

func (*WrapperRegistry) Get

func (r *WrapperRegistry) Get(typeName string) (WrapperFactory, bool)

Get retrieves a wrapper factory by type name.

func (*WrapperRegistry) Register

func (r *WrapperRegistry) Register(typeName string, factory WrapperFactory)

Register adds a wrapper factory for a type name (instance-specific).

func (*WrapperRegistry) Remove added in v0.15.0

func (r *WrapperRegistry) Remove(typeName string)

Remove removes a wrapper from the registry.

Jump to

Keyboard shortcuts

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