diff --git a/versions/native-modules/docs/api/hilbish/hilbish.module/index.html b/versions/native-modules/docs/api/hilbish/hilbish.module/index.html index 64f9f1e..e177bf0 100644 --- a/versions/native-modules/docs/api/hilbish/hilbish.module/index.html +++ b/versions/native-modules/docs/api/hilbish/hilbish.module/index.html @@ -2,16 +2,26 @@

Interface hilbish.module

native module loading

Introduction -

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

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 +

The hilbish.module interface provides a function to load +Hilbish plugins/modules. Hilbish modules are Go-written +plugins (see https://pkg.go.dev/plugin +) 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 https://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime

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

Interface fields +it to use it for a native plugin.

Here is some code for an example plugin:

package main
+
+import (
+	rt "github.com/arnodel/golua/runtime"
+)
+
+func Loader(rtm *rt.Runtime) rt.Value {
+	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!”

Interface fields

  • paths: A 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

Functions

load(path)

Loads a module at the designated path. diff --git a/versions/native-modules/docs/api/hilbish/index.xml b/versions/native-modules/docs/api/hilbish/index.xml index 65ab35f..59050c3 100644 --- a/versions/native-modules/docs/api/hilbish/index.xml +++ b/versions/native-modules/docs/api/hilbish/index.xml @@ -18,8 +18,7 @@ Jobs are the name of background tasks/commands. A job can be started via interac Functions add(cmdstr, args, execPath) Adds a new job to the job table. Note that this does not immediately run it. all() -> table<Job> Returns a table of all job objects. disown(id) Disowns a job. This deletes it from the job table.Interface hilbish.modulehttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/Introduction The hilbish.module interface provides a function to load Hilbish plugins/modules. Hilbish modules are Go-written plugins (see https://pkg.go.dev/plugin ) that are used to add functionality to Hilbish that cannot be written in Lua for any reason. -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 https://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime Hilbish uses this package as its Lua runtime.Interface hilbish.oshttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/ Introduction The os interface provides simple text information properties about the current OS on the systen. This mainly includes the name and version. +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.Interface hilbish.oshttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/ Introduction The os interface provides simple text information properties about the current OS on the systen. This mainly includes the name and version. Interface fields family: Family name of the current OS name: Pretty name of the current OS version: Version of the current OSInterface hilbish.runnerhttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/Introduction The runner interface contains functions that allow the user to change how Hilbish interprets interactive input. Users can add and change the default runner for interactive input to any language or script of their choosing. A good example is using it to write command in Fennel. Functions setMode(cb) This is the same as the hilbish.runnerMode function. It takes a callback, which will be used to execute all interactive input.Interface hilbish.timershttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/Introduction If you ever want to run a piece of code on a timed interval, or want to wait a few seconds, you don’t have to rely on timing tricks, as Hilbish has a timer API to set intervals and timeouts. These are the simple functions hilbish.interval and hilbish.timeout (doc accessible with doc hilbish). But if you want slightly more control over them, there is the hilbish.timers interface. It allows you to get a timer via ID and control them.Interface hilbish.userDirhttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/ Introduction This interface just contains properties to know about certain user directories. It is equivalent to XDG on Linux and gets the user’s preferred directories for configs and data. diff --git a/versions/native-modules/index.xml b/versions/native-modules/index.xml index 042e7ce..6619370 100644 --- a/versions/native-modules/index.xml +++ b/versions/native-modules/index.xml @@ -34,8 +34,7 @@ Jobs are the name of background tasks/commands. A job can be started via interac Functions add(cmdstr, args, execPath) Adds a new job to the job table. Note that this does not immediately run it. all() -> table<Job> Returns a table of all job objects. disown(id) Disowns a job. This deletes it from the job table.Interface hilbish.modulehttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/Introduction The hilbish.module interface provides a function to load Hilbish plugins/modules. Hilbish modules are Go-written plugins (see https://pkg.go.dev/plugin ) that are used to add functionality to Hilbish that cannot be written in Lua for any reason. -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 https://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime Hilbish uses this package as its Lua runtime.Interface hilbish.oshttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/ Introduction The os interface provides simple text information properties about the current OS on the systen. This mainly includes the name and version. +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.Interface hilbish.oshttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/ Introduction The os interface provides simple text information properties about the current OS on the systen. This mainly includes the name and version. Interface fields family: Family name of the current OS name: Pretty name of the current OS version: Version of the current OSInterface hilbish.runnerhttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/Introduction The runner interface contains functions that allow the user to change how Hilbish interprets interactive input. Users can add and change the default runner for interactive input to any language or script of their choosing. A good example is using it to write command in Fennel. Functions setMode(cb) This is the same as the hilbish.runnerMode function. It takes a callback, which will be used to execute all interactive input.Interface hilbish.timershttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/Introduction If you ever want to run a piece of code on a timed interval, or want to wait a few seconds, you don’t have to rely on timing tricks, as Hilbish has a timer API to set intervals and timeouts. These are the simple functions hilbish.interval and hilbish.timeout (doc accessible with doc hilbish). But if you want slightly more control over them, there is the hilbish.timers interface. It allows you to get a timer via ID and control them.Interface hilbish.userDirhttps://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/Mon, 01 Jan 0001 00:00:00 +0000https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/ Introduction This interface just contains properties to know about certain user directories. It is equivalent to XDG on Linux and gets the user’s preferred directories for configs and data.