| Hey, The manpages for lua(4) and luactl(8) may be of help. lua(4) is the device driver which allows you manage Lua states in the kernel through an ioctl interface. With luactl(8) you can create and destroy states, load and execute scripts, and require modules. Example: 1. Load lua(4) driver
modload lua
2. Create a Lua state in the kernel
luactl create s0
3. Load and execute a script named hello.lua
luactl load s0 ./hello.lua
4. dmesg A Lua state is created empty. In order to load the standard libs (base, string, table, ...) into that state you'd need to do a luaL_openlibs(). Even though the libs are compiled into lua(4), you can't easily load them with luactl. [1] is a patch that adds a 'openlibs' command to luactl. After you apply it and recompile luactl, you can do that: luactl openlibs s0 Btw, we've ported Lua test suite to the NetBSD kernel in this year's GSoC. Part of the work was on porting parts of the standard libraries which were not available in kernel Lua (e.g., os, io, math). Take a look at [2]. Let me know if you need any help. My email address is my HN username at gmail.com ----
[1] https://github.com/gmesalazar/kerneltest/blob/master/kernel/...
[2] https://github.com/gmesalazar/kerneltest/ |