gh-pages
TorchedSammy 2023-07-11 14:45:38 +00:00
parent 308ae0e4f4
commit 58f667b0eb
3 changed files with 21 additions and 13 deletions

View File

@ -2,16 +2,26 @@
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin=anonymous referrerpolicy=no-referrer><style>.heading>.heading-link{opacity:0}.heading:hover>.heading-link{visibility:visible;opacity:1;transition:all .1s ease-in}</style></head><body class="d-flex flex-column min-vh-100" style=overflow-x:hidden><svg xmlns="http://www.w3.org/2000/svg" style="display:none"><symbol id="check-circle-fill" fill="currentcolor" viewBox="0 0 16 16"><path d="M16 8A8 8 0 110 8a8 8 0 0116 0zm-3.97-3.03a.75.75.0 00-1.08.022L7.477 9.417 5.384 7.323a.75.75.0 00-1.06 1.06L6.97 11.03a.75.75.0 001.079-.02l3.992-4.99a.75.75.0 00-.01-1.05z"/></symbol><symbol id="info-fill" fill="currentcolor" viewBox="0 0 16 16"><path d="M8 16A8 8 0 108 0a8 8 0 000 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194.0.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703.0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 110-2 1 1 0 010 2z"/></symbol><symbol id="exclamation-triangle-fill" fill="currentcolor" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13.0 00-1.96.0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889.0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535.0.954.462.9.995l-.35 3.507a.552.552.0 01-1.1.0L7.1 5.995A.905.905.0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"/></symbol></svg><header><nav class="navbar navbar-expand-md sticky-top bg-light border-bottom"><div class=container-fluid><a class=navbar-brand href=/Hilbish><img src=/Hilbish/hilbish-logo-and-text.png alt height=48></a>
<button class=navbar-toggler type=button data-bs-toggle=collapse data-bs-target=#navbarSupportedContent aria-controls=navbarSupportedContent aria-expanded=false aria-label="Toggle navigation">
<span class=navbar-toggler-icon></span></button><div class="collapse navbar-collapse" id=navbarSupportedContent><ul class="navbar-nav me-auto mb-2 mb-lg-0"><li class=nav-item><a href=/Hilbish/versions/native-modules/ class=nav-link>Home</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/install/ class=nav-link>Install</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/ class=nav-link>Docs</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/blog/ class=nav-link>Blog</a></li></ul></div></div></nav></header><style>@media(min-width:768px){.sidenav{width:240px}}</style><div class=row><nav class="navbar-expand-md bg-light sidenav border-end"><div class=container><div class="collapse navbar-collapse" id=navbarSupportedContent><nav class="navbar navbar-expand-md bg-light sidenav col" style=margin-top:-20px><ul class="navbar-nav me-auto mb-2 mb-lg-0 flex-column col mt-4"><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/ class=nav-link><strong>Introduction</strong></a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/getting-started/ class=nav-link><strong>Getting Started</strong></a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/faq/ class=nav-link><strong>Frequently Asked Questions</strong></a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/features/ class=nav-link><strong>Features</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/features/notifications/ class=nav-link>Notification</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/features/runner-mode/ class=nav-link>Runner Mode</a></li></ul><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/ class=nav-link><strong>API</strong></a></li><ul style=list-style:none><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.aliases/ class=nav-link>Interface hilbish.aliases</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.completions/ class=nav-link>Interface hilbish.completions</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.editor/ class=nav-link>Interface hilbish.editor</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.history/ class=nav-link>Interface hilbish.history</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.jobs/ class=nav-link>Interface hilbish.jobs</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/ class=nav-link>Interface hilbish.module</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/ class=nav-link>Interface hilbish.os</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/ class=nav-link>Interface hilbish.runner</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/ class=nav-link>Interface hilbish.timers</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/ class=nav-link>Interface hilbish.userDir</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/bait/ class=nav-link>Module bait</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/commander/ class=nav-link>Module commander</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/fs/ class=nav-link>Module fs</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/hilbish/ class=nav-link>Module hilbish</a></li><li class=nav-item><a href=/Hilbish/versions/native-modules/docs/api/terminal/ class=nav-link>Module terminal</a></li></ul></ul></nav></div></div></nav><container class="col mt-2" style="padding-left: 20px; padding-right: 20px;"><div><h1>Interface hilbish.module</h1><p><em>native module loading<br></em></p><h3 id=introduction class=heading>Introduction
<a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>The hilbish.module interface provides a function
to load Hilbish plugins/modules.
Hilbish modules are Go-written plugins (see <a href=https://pkg.go.dev/plugin target=_blank rel=noopener>https://pkg.go.dev/plugin</a>
)
that are used to add functionality to Hilbish that cannot be written
in Lua for any reason.</p><p>To make a valid native module, the Go plugin
has to export a Loader function with a signature like so:
<code>func(*rt.Runtime) rt.Value</code>.</p><p><code>rt</code> in this case refers to the Runtime type at
<a href=#introduction class=heading-link><i class="fas fa-paperclip"></i></a></h3><p>The hilbish.module interface provides a function to load
Hilbish plugins/modules. Hilbish modules are Go-written
plugins (see <a href=https://pkg.go.dev/plugin target=_blank rel=noopener>https://pkg.go.dev/plugin</a>
) that are used to add functionality
to Hilbish that cannot be written in Lua for any reason.</p><p>Note that you don&rsquo;t ever need to use the load function that is here as
modules can be loaded with a <code>require</code> call like Lua C modules, and the
search paths can be changed with the <code>paths</code> property here.</p><p>To make a valid native module, the Go plugin has to export a Loader function
with a signature like so: <code>func(*rt.Runtime) rt.Value</code>.</p><p><code>rt</code> in this case refers to the Runtime type at
<a href=https://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime target=_blank rel=noopener>https://pkg.go.dev/github.com/arnodel/golua@master/runtime#Runtime</a></p><p>Hilbish uses this package as its Lua runtime. You will need to read
it to use it for a native plugin.</p><h3 id=interface-fields class=heading>Interface fields
it to use it for a native plugin.</p><p>Here is some code for an example plugin:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-go data-lang=go><span style=display:flex><span><span style=color:#f92672>package</span> <span style=color:#a6e22e>main</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#f92672>import</span> (
</span></span><span style=display:flex><span> <span style=color:#a6e22e>rt</span> <span style=color:#e6db74>&#34;github.com/arnodel/golua/runtime&#34;</span>
</span></span><span style=display:flex><span>)
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#66d9ef>func</span> <span style=color:#a6e22e>Loader</span>(<span style=color:#a6e22e>rtm</span> <span style=color:#f92672>*</span><span style=color:#a6e22e>rt</span>.<span style=color:#a6e22e>Runtime</span>) <span style=color:#a6e22e>rt</span>.<span style=color:#a6e22e>Value</span> {
</span></span><span style=display:flex><span> <span style=color:#66d9ef>return</span> <span style=color:#a6e22e>rt</span>.<span style=color:#a6e22e>StringValue</span>(<span style=color:#e6db74>&#34;hello world!&#34;</span>)
</span></span><span style=display:flex><span>}
</span></span></code></pre></div><p>This can be compiled with <code>go build -buildmode=plugin plugin.go</code>.
If you attempt to require and print the result (<code>print(require 'plugin')</code>), it will show &ldquo;hello world!&rdquo;</p><h3 id=interface-fields class=heading>Interface fields
<a href=#interface-fields class=heading-link><i class="fas fa-paperclip"></i></a></h3><ul><li><code>paths</code>: 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: <code>?.so;?/?.so</code></li></ul><h3 id=functions class=heading>Functions
<a href=#functions class=heading-link><i class="fas fa-paperclip"></i></a></h3><h4 id=loadpath class=heading>load(path)
<a href=#loadpath class=heading-link><i class="fas fa-paperclip"></i></a></h4><p>Loads a module at the designated <code>path</code>.

View File

@ -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() -&amp;gt; table&amp;lt;Job&amp;gt; Returns a table of all job objects.
disown(id) Disowns a job. This deletes it from the job table.</description></item><item><title>Interface hilbish.module</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/</guid><description>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.</description></item><item><title>Interface hilbish.os</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</guid><description> 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&amp;rsquo;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.</description></item><item><title>Interface hilbish.os</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</guid><description> 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 OS</description></item><item><title>Interface hilbish.runner</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/</guid><description>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.</description></item><item><title>Interface hilbish.timers</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/</guid><description>Introduction If you ever want to run a piece of code on a timed interval, or want to wait a few seconds, you don&amp;rsquo;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.</description></item><item><title>Interface hilbish.userDir</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/</guid><description> Introduction This interface just contains properties to know about certain user directories. It is equivalent to XDG on Linux and gets the user&amp;rsquo;s preferred directories for configs and data.

View File

@ -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() -&amp;gt; table&amp;lt;Job&amp;gt; Returns a table of all job objects.
disown(id) Disowns a job. This deletes it from the job table.</description></item><item><title>Interface hilbish.module</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.module/</guid><description>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.</description></item><item><title>Interface hilbish.os</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</guid><description> 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&amp;rsquo;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.</description></item><item><title>Interface hilbish.os</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.os/</guid><description> 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 OS</description></item><item><title>Interface hilbish.runner</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.runner/</guid><description>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.</description></item><item><title>Interface hilbish.timers</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.timers/</guid><description>Introduction If you ever want to run a piece of code on a timed interval, or want to wait a few seconds, you don&amp;rsquo;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.</description></item><item><title>Interface hilbish.userDir</title><link>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://rosettea.github.io/Hilbish/versions/native-modules/docs/api/hilbish/hilbish.userdir/</guid><description> Introduction This interface just contains properties to know about certain user directories. It is equivalent to XDG on Linux and gets the user&amp;rsquo;s preferred directories for configs and data.