Module hilbish.module

native module loading


The hilbish.module interface provides a function to load Hilbish plugins/modules. Hilbish modules are Go-written plugins (see ) that are used to add functionality to Hilbish that cannot be written in Lua for any reason.

Note that you don’t ever need to use the load function that is here as modules can be loaded with a require call like Lua C modules, and the search paths can be changed with the paths property here.

To make a valid native module, the Go plugin has to export a Loader function with a signature like so: func(*rt.Runtime) rt.Value.

rt in this case refers to the Runtime type at

Hilbish uses this package as its Lua runtime. You will need to read it to use it for a native plugin.

Here is some code for an example plugin:

1package main
3import (
4	rt ""
7func Loader(rtm *rt.Runtime) rt.Value {
8	return rt.StringValue("hello world!")

This can be compiled with go build -buildmode=plugin plugin.go. If you attempt to require and print the result (print(require 'plugin')), it will show “hello world!”


load(path)Loads a module at the designated path.

Static module fields

pathsA list of paths to search when loading native modules. This is in the style of Lua search paths and will be used when requiring native modules. Example: ?.so;?/?.so


Loads a module at the designated path.
It will throw if any error occurs.


string path