diff options
Diffstat (limited to 'static/netbsd/man4/lua.4 4.html')
| -rw-r--r-- | static/netbsd/man4/lua.4 4.html | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/static/netbsd/man4/lua.4 4.html b/static/netbsd/man4/lua.4 4.html new file mode 100644 index 00000000..9f3161e7 --- /dev/null +++ b/static/netbsd/man4/lua.4 4.html @@ -0,0 +1,189 @@ +<table class="head"> + <tr> + <td class="head-ltitle">LUA(4)</td> + <td class="head-vol">Device Drivers Manual</td> + <td class="head-rtitle">LUA(4)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">lua</code> — <span class="Nd">control + in-kernel Lua states</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<p class="Pp"><code class="Cd">lua*</code></p> +<p class="Pp"> + <br/> + <code class="In">#include <<a class="In">sys/types.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/lua.h</a>></code></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The <code class="Nm">lua</code> device allows to create, control, + and delete Lua states in the kernel through an <a class="Xr">ioctl(2)</a> + interface. Moreover, <code class="Nm">lua</code> can be used to load Lua + scripts into a Lua state and to assign modules to an existing state, i.e. + perform the equivalent of the Lua command <i class="Em">require</i>. + <code class="Nm">lua</code> is also used to retrieve information about + currently active Lua states.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="LUA_MODULES"><a class="permalink" href="#LUA_MODULES">LUA + MODULES</a></h1> +<p class="Pp">Lua modules are used to provide functionality to Lua scripts not + available in the language itself, e.g. to access core kernel functionality + like printing text on the console. Unlike in user space Lua, where Lua + modules are files in the filesystem, modules must be provided to + <code class="Nm">lua</code> in the form of loadable kernel modules that + register their functionality with <code class="Nm">lua</code>. Modules are + loaded using the <code class="Ic">require</code> Lua command; whether this + command is available or not is controlled by a <a class="Xr">sysctl(8)</a> + variable. <code class="Nm">lua</code> by default tries to load a kernel + module named + <a class="permalink" href="#luafoo.kmod"><i class="Em" id="luafoo.kmod">luafoo.kmod</i></a> + when it encounters the Lua command <i class="Em">require 'foo'</i>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYSCTL_VARIABLES"><a class="permalink" href="#SYSCTL_VARIABLES">SYSCTL + VARIABLES</a></h1> +<p class="Pp">The operation of <code class="Nm">lua</code> can be controlled by + means of the following <a class="Xr">sysctl(8)</a> variables:</p> +<dl class="Bl-tag"> + <dt id="kern.lua.autoload"><a class="permalink" href="#kern.lua.autoload"><code class="Dv">kern.lua.autoload</code></a></dt> + <dd>When set to 1, <code class="Nm">lua</code> tries to autoload kernel + modules. + <p class="Pp">The default value is 1.</p> + </dd> + <dt id="kern.lua.bytecode"><a class="permalink" href="#kern.lua.bytecode"><code class="Dv">kern.lua.bytecode</code></a></dt> + <dd>When set to 1, loading of Lua bytecode is allowed. + <p class="Pp">The default value is 0.</p> + </dd> + <dt id="kern.lua.maxcount"><a class="permalink" href="#kern.lua.maxcount"><code class="Dv">kern.lua.maxcount</code></a></dt> + <dd>When set to a value > 0, <code class="Nm">lua</code> limits the number + of instructions executed to this number. + <p class="Pp">The default value is 0.</p> + </dd> + <dt id="kern.lua.require"><a class="permalink" href="#kern.lua.require"><code class="Dv">kern.lua.require</code></a></dt> + <dd>When set to 1, enables the <i class="Em">require</i> command in Lua. + <p class="Pp">The default value is 1.</p> + </dd> + <dt id="kern.lua.verbose"><a class="permalink" href="#kern.lua.verbose"><code class="Dv">kern.lua.verbose</code></a></dt> + <dd>When set to a value > 0, verbosity is increased. + <p class="Pp">The default value is 0.</p> + </dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="IOCTL_INTERFACE"><a class="permalink" href="#IOCTL_INTERFACE">IOCTL + INTERFACE</a></h1> +<p class="Pp">The following structures and constants are defined in the + <code class="In"><<a class="In">sys/lua.h</a>></code> header file:</p> +<p class="Pp"></p> +<dl class="Bl-tag Bl-compact"> + <dt id="LUAINFO(struct"><a class="permalink" href="#LUAINFO(struct"><code class="Dv">LUAINFO(struct + lua_info)</code></a></dt> + <dd>Returns information about the <code class="Nm">lua</code> states in the + <var class="Fa">lua_info</var> structure: + <div class="Bd Pp Li"> + <pre>#define MAX_LUA_NAME 16 +#define MAX_LUA_DESC 64 + +struct lua_state_info { + char name[MAX_LUA_NAME]; + char desc[MAX_LUA_DESC]; + bool user; +}; + +struct lua_info { + int num_states; /* total number of Lua states */ + struct lua_state_info *states; +};</pre> + </div> + <p class="Pp"></p> + </dd> + <dt id="LUACREATE(struct"><a class="permalink" href="#LUACREATE(struct"><code class="Dv">LUACREATE(struct + lua_create)</code></a></dt> + <dd>Create a new named Lua state with name and description in the + <var class="Fa">lua_create</var> structure: + <div class="Bd Pp Li"> + <pre>struct lua_create { + char name[MAX_LUA_NAME]; + char desc[MAX_LUA_DESC]; +};</pre> + </div> + <p class="Pp"></p> + </dd> + <dt id="LUADESTROY(struct"><a class="permalink" href="#LUADESTROY(struct"><code class="Dv">LUADESTROY(struct + lua_create)</code></a></dt> + <dd>Destroy a named Lua state. + <p class="Pp"></p> + </dd> + <dt id="LUAREQUIRE(struct"><a class="permalink" href="#LUAREQUIRE(struct"><code class="Dv">LUAREQUIRE(struct + lua_require)</code></a></dt> + <dd>Perform the equivalent of the Lua command <i class="Em">require</i> in a + named state. The name of the state and of the module name is passed in the + <var class="Fa">lua_require</var> structure: + <div class="Bd Pp Li"> + <pre>#define LUA_MAX_MODNAME 32 + +struct lua_require { + char state[MAX_LUA_NAME]; + char module[LUA_MAX_MODNAME]; +};</pre> + </div> + <p class="Pp"></p> + </dd> + <dt id="LUALOAD(struct"><a class="permalink" href="#LUALOAD(struct"><code class="Dv">LUALOAD(struct + lua_load)</code></a></dt> + <dd>Load Lua code from the filesystem into a named Lua state. The name of the + state and the path to the Lua code are passed in the + <var class="Fa">lua_load</var> structure: + <div class="Bd Pp Li"> + <pre>struct lua_load { + char state[MAX_LUA_NAME]; + char path[MAXPATHLEN]; +};</pre> + </div> + <p class="Pp">The path element of the <var class="Fa">lua_load</var> + structure must contain at least one ‘/’ character.</p> + </dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1> +<dl class="Bl-tag Bl-compact"> + <dt>/dev/lua</dt> + <dd>Lua device file.</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<p class="Pp"><a class="Xr">ioctl(2)</a>, <a class="Xr">luactl(8)</a></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> +<p class="Pp">The <code class="Nm">lua</code> device first appeared in + <span class="Ux">NetBSD 7.0</span>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<p class="Pp">The <code class="Nm">lua</code> driver was written by + <span class="An">Marc Balmer</span> + <<a class="Mt" href="mailto:mbalmer@NetBSD.org">mbalmer@NetBSD.org</a>>.</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="CAVEATS"><a class="permalink" href="#CAVEATS">CAVEATS</a></h1> +<p class="Pp">The <code class="Nm">lua</code> device is experimental. + Incompatible changes might be made in the future.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">July 25, 2014</td> + <td class="foot-os">NetBSD 10.1</td> + </tr> +</table> |
