From 253e67c8b3a72b3a4757fdbc5845297628db0a4a Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Sat, 25 Apr 2026 19:55:15 -0400 Subject: docs: Added All NetBSD Manuals --- static/netbsd/man4/lua.4 4.html | 189 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 static/netbsd/man4/lua.4 4.html (limited to 'static/netbsd/man4/lua.4 4.html') 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 @@ + + + + + + +
LUA(4)Device Drivers ManualLUA(4)
+
+
+

+

luacontrol + in-kernel Lua states

+
+
+

+

lua*

+

+
+ #include <sys/types.h> +
+ #include <sys/lua.h>

+
+
+

+

The lua device allows to create, control, + and delete Lua states in the kernel through an ioctl(2) + interface. Moreover, lua 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 require. + lua is also used to retrieve information about + currently active Lua states.

+
+
+

+

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 + lua in the form of loadable kernel modules that + register their functionality with lua. Modules are + loaded using the require Lua command; whether this + command is available or not is controlled by a sysctl(8) + variable. lua by default tries to load a kernel + module named + + when it encounters the Lua command require 'foo'.

+
+
+

+

The operation of lua can be controlled by + means of the following sysctl(8) variables:

+
+
+
When set to 1, lua tries to autoload kernel + modules. +

The default value is 1.

+
+
+
When set to 1, loading of Lua bytecode is allowed. +

The default value is 0.

+
+
+
When set to a value > 0, lua limits the number + of instructions executed to this number. +

The default value is 0.

+
+
+
When set to 1, enables the require command in Lua. +

The default value is 1.

+
+
+
When set to a value > 0, verbosity is increased. +

The default value is 0.

+
+
+
+
+

+

The following structures and constants are defined in the + <sys/lua.h> header file:

+

+
+
+
Returns information about the lua states in the + lua_info structure: +
+
#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;
+};
+
+

+
+
+
Create a new named Lua state with name and description in the + lua_create structure: +
+
struct lua_create {
+	char	name[MAX_LUA_NAME];
+	char	desc[MAX_LUA_DESC];
+};
+
+

+
+
+
Destroy a named Lua state. +

+
+
+
Perform the equivalent of the Lua command require in a + named state. The name of the state and of the module name is passed in the + lua_require structure: +
+
#define LUA_MAX_MODNAME		32
+
+struct lua_require {
+	char	state[MAX_LUA_NAME];
+	char	module[LUA_MAX_MODNAME];
+};
+
+

+
+
+
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 + lua_load structure: +
+
struct lua_load {
+	char	state[MAX_LUA_NAME];
+	char	path[MAXPATHLEN];
+};
+
+

The path element of the lua_load + structure must contain at least one ‘/’ character.

+
+
+
+
+

+
+
/dev/lua
+
Lua device file.
+
+
+
+

+

ioctl(2), luactl(8)

+
+
+

+

The lua device first appeared in + NetBSD 7.0.

+
+
+

+

The lua driver was written by + Marc Balmer + <mbalmer@NetBSD.org>.

+
+
+

+

The lua device is experimental. + Incompatible changes might be made in the future.

+
+
+ + + + + +
July 25, 2014NetBSD 10.1
-- cgit v1.2.3