tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [patch] put Lua standard libraries into the kernel

Am 26.11.13 12:13, schrieb Lourival Vieira Neto:
> Hi Marc,
> On Tue, Nov 26, 2013 at 6:18 AM, Marc Balmer <> wrote:
>> Am 26.11.13 02:50, schrieb Lourival Vieira Neto:
>>> Hi Folks,
>>> Here is a patch that puts some Lua standard libraries into the kernel:
>>> - Auxiliary library (C API);
>>> - Base library;
>>> - String library;
>>> - Table library.
>> In the kernel, Lua states are created empty _on purpose_.  So the Lua
>> standard library should be a module (or modules) in kernel space.
> Why?
> Note, the Lua states still empty, but, with this patch, you can call
> luaL_openlibs().
>> Whether all standard libraries should be one module, or rather multiple
>> kernel modules, is to be discussed.
> Let's discuss then =).

My suggestion is this:

Build with lauxlib and also build the standard libraries
Create a new sysctl kern.lua.stdlib, set to one by default
If a new state is created in lua(4), run lua_openlib(...) on that state
if kern.lua.stdlib is set to a vaue != 0

So by default a kernel Lua state would then have the stdlibs available,
much you have them available when running lua(1).

>> But please don't load the automatically.
> Do you mean 'don't link Lua stdlib with Lua'? What is the reason?
> Regards,

Home | Main Index | Thread Index | Old Index