pluginhelper

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package pluginhelper provides helper functions for creating Nxlang plugins Plugin developers can use this package to simplify plugin development

Index

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

func (pb *PluginBase) AddFunction(name string, fn func(args ...types.Object) types.Object)

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) Cleanup

func (pb *PluginBase) Cleanup() error

Cleanup is a no-op cleanup

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

Jump to

Keyboard shortcuts

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