<spanclass=navbar-toggler-icon></span></button><divclass="collapse navbar-collapse"id=navbarSupportedContent><ulclass="navbar-nav me-auto mb-2 mb-lg-0"><liclass=nav-item><ahref=/Hilbish/class=nav-link>Home</a></li><liclass=nav-item><ahref=/Hilbish/install/class=nav-link>Install</a></li><liclass=nav-item><ahref=/Hilbish/docs/class=nav-link>Docs</a></li></ul></div></div></nav></header><divclass="container py-3 row"><divclass=containerstyle=width:240px><divclass="p-3 col"><ulclass="nav nav-pills mb-auto"><liclass=nav-item><ahref=/Hilbish/docs/class=nav-link><strong>Introduction</strong></a></li><liclass=nav-item><ahref=/Hilbish/docs/getting-started/class=nav-link><strong>Getting Started</strong></a></li><liclass=nav-item><ahref=/Hilbish/docs/faq/class=nav-link><strong>Frequently Asked Questions</strong></a></li><liclass=nav-item><ahref=/Hilbish/docs/features/class=nav-link><strong>Features</strong></a></li><ulstyle=list-style:none><liclass=nav-item><ahref=/Hilbish/docs/features/runner-mode/class=nav-link>Runner Mode</a></li></ul></ul></div></div><divclass="p-3 col"><div><h1>Runner Mode</h1><p><em>Last updated Dec 13, 2022<br>Customize the interactive script/command runner.<br></em></p><p>Hilbish is <em>unique,</em> when interactive it first attempts to run input as
</span></span></code></pre></div><p>The <code>hilbish.runner</code> interface is an alternative to using <code>hilbish.runnerMode</code>
and also provides the sh and Lua runner functions that Hilbish itself uses.
A runner function is expected to return 3 values: the input, exit code, and an error.
The input return is there incase you need to prompt for more input.
If you don’t, just return the input passed to the runner function.
The exit code has to be a number, it will be 0 otherwise and the error can be
<code>nil</code> to indicate no error.</p><h3id=functions>Functions</h3><p>These are the “low level” functions for the <code>hilbish.runner</code> interface.</p><ul><li>setMode(mode) > The same as <code>hilbish.runnerMode</code></li><li>sh(input) -> input, code, err > Runs <code>input</code> in Hilbish’s sh interpreter</li><li>lua(input) -> input, code, err > Evals <code>input</code> as Lua code</li></ul><p>The others here are defined in Lua and have EmmyLua documentation.
These functions should be preferred over the previous ones.</p><ul><li>setCurrent(mode) > The same as <code>setMode</code>, but works with runners managed
via the functions below.</li><li>add(name, runner) > Adds a runner to a table of available runners. The <code>runner</code>
argument is either a function or a table with a run callback.</li><li>set(name, runner) > The same as <code>add</code> but requires passing a table and
overwrites if the <code>name</code>d runner already exists.</li><li>get(name) > runner > Gets a runner by name. It is a table with at least a
run function, to run input.</li><li>exec(cmd, runnerName) > Runs <code>cmd</code> with a runner. If <code>runnerName</code> isn’t passed,