Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer: scans Go source files and extracts Lua module definitions
func (*Analyzer) GenerateModuleStub ¶
GenerateModuleStub: generates a Lua annotation stub for a single module. This is the recommended format for per-module files in a library/ directory.
func (*Analyzer) GenerateStubs ¶
GenerateStubs: generates Lua annotation stubs for all discovered modules
func (*Analyzer) GetModules ¶
GetModules: returns a map of module names to module definitions
func (*Analyzer) ModuleCount ¶
ModuleCount: returns the number of modules discovered
func (*Analyzer) ScanDirectory ¶
ScanDirectory: recursively scans a directory for Go files and extracts Lua module metadata. It parses comment annotations like @luamodule, @luafunc, @luaparam, @luareturn.
type GenerateConfig ¶ added in v0.0.2
type GenerateConfig struct {
// ScanDir is the directory to scan for Go files with @luafunc annotations
ScanDir string
// OutputDir is the output directory for generated Lua files
OutputDir string
// ModuleName is the name of the module for Lua code generation
ModuleName string
// OutputFile is the name of the generated Lua file (e.g., "k8sclient.gen.lua")
OutputFile string
// Types is an optional list of types to register for stub generation
Types []interface{}
}
GenerateConfig: configuration for stub generation
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator: combines function stub generation (from annotations) and type stub generation (from TypeRegistry). This provides a simple API for modules to generate complete Lua stubs.
func (*Generator) Generate ¶ added in v0.0.2
func (g *Generator) Generate(config GenerateConfig) (string, error)
Generate: generates Lua stubs for a module based on the provided configuration. This method orchestrates the entire stub generation process: 1. Scans the specified directory for annotated functions 2. Registers any provided types 3. Processes type dependencies 4. Generates combined stubs 5. Writes output to the specified file
Returns the path to the generated file or an error.
func (*Generator) GenerateModule ¶
GenerateModule: generates complete Lua stubs for a module (functions + types merged into one file). Returns the combined stub content or an error.
func (*Generator) ProcessTypes ¶
ProcessTypes: processes all registered types to discover dependencies
func (*Generator) RegisterType ¶
RegisterType: registers a Go type for Lua stub generation
func (*Generator) ScanDirectory ¶
ScanDirectory: scans a directory for Go files with @luafunc annotations
type LuaClass ¶ added in v0.0.2
type LuaClass struct {
Name string
Description string
Methods []*LuaMethod
Fields []*LuaField
CustomAnnotations []string
}
LuaClass: represents a Lua class (UserData type with methods)
type LuaFunction ¶
type LuaFunction struct {
Name string
Description string
Params []*LuaParam
Returns []*LuaReturn
CustomAnnotations []string // Function-level custom annotations
}
LuaFunction: represents a Lua function exported by a module
type LuaMethod ¶ added in v0.0.2
type LuaMethod struct {
Name string
Description string
Params []*LuaParam
Returns []*LuaReturn
CustomAnnotations []string
}
LuaMethod: represents a method on a Lua class
type LuaModule ¶
type LuaModule struct {
Name string
Functions []*LuaFunction
Classes []*LuaClass
Constants []*LuaConst
CustomAnnotations []string // Module-level custom annotations
}
LuaModule: represents a discovered Lua module