Documentation
¶
Overview ¶
Package pluginhelper provides helper functions for creating Nxlang plugins Plugin developers can use this package to simplify plugin development
Index ¶
- type PluginBase
- func (pb *PluginBase) AddFunction(name string, fn func(args ...types.Object) types.Object)
- func (pb *PluginBase) AddIntFunction(name string, fn func(args ...int) int)
- func (pb *PluginBase) AddStringFunction(name string, fn func(args ...string) string)
- func (pb *PluginBase) Cleanup() error
- func (pb *PluginBase) GetFunctions() []plugin.PluginFunction
- func (pb *PluginBase) Info() plugin.PluginInfo
- func (pb *PluginBase) Initialize() error
- type SimplePlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PluginBase ¶
type PluginBase struct {
// contains filtered or unexported fields
}
PluginBase is a helper struct for creating plugins
func NewPluginBase ¶
func NewPluginBase(name, version, description, author string) *PluginBase
NewPluginBase creates a new plugin base with the given info
func (*PluginBase) AddFunction ¶
AddFunction adds a function to the plugin
func (*PluginBase) AddIntFunction ¶
func (pb *PluginBase) AddIntFunction(name string, fn func(args ...int) int)
AddIntFunction adds a function that takes int arguments and returns an int
func (*PluginBase) AddStringFunction ¶
func (pb *PluginBase) AddStringFunction(name string, fn func(args ...string) string)
AddStringFunction adds a function that takes string arguments and returns a string
func (*PluginBase) GetFunctions ¶
func (pb *PluginBase) GetFunctions() []plugin.PluginFunction
GetFunctions returns all registered functions
func (*PluginBase) Info ¶
func (pb *PluginBase) Info() plugin.PluginInfo
Info returns the plugin info
func (*PluginBase) Initialize ¶
func (pb *PluginBase) Initialize() error
Initialize is a no-op initialization
type SimplePlugin ¶
type SimplePlugin struct {
*PluginBase
}
SimplePlugin is a simplified plugin wrapper for basic use cases
func NewSimplePlugin ¶
func NewSimplePlugin(name, version, description, author string) *SimplePlugin
NewSimplePlugin creates a new simple plugin