module

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0, MIT Imports: 6 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(r *rt.Runtime) error

Init installs the preloaded modules onto the runtime.

func IsRegistered

func IsRegistered(name string) bool

IsRegistered returns true iff the named module is registered.

func Register

func Register(info Info)

Register registers the given module to be installed in any future vm. This will panic if the provided information is invalid, or if a module is already registered with this name.

Types

type Info

type Info struct {
	Name        string   // The module name
	Description string   // A brief description of the module
	URL         string   // A url for further documentation
	Load        LoadFunc // The function that creates and returns the module
	Preload     bool     // Is the module pre-loaded?
	Requires    []string // Ensure that the given modules are loaded first. Note that circular requirements are not protected against.
}

Info is used to register a module.

func GetInfo

func GetInfo(name string) (Info, bool)

GetInfo returns returns the Info for the given module. The second return value will be false iff the module is not registered.

func Registered

func Registered() []Info

Registered returns a slice of of all currently registered modules.

type LoadFunc

type LoadFunc func(*rt.Runtime) (*rt.Table, error)

LoadFunc is a function that loads and returns a module.

Jump to

Keyboard shortcuts

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