[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: loadstring() of compiled-in data buffer
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 1 Sep 2007 10:11:03 -0300
> is there I way I can tell the Lua state to use _my_ buffer of bytecode
> and not to make its own copy?
Not without patching the code. This is something that I've wanted to do
for a long time; it think it's the oldest item in my TODO list for luac:
It shouldn't be too hard. Essentially you need to tell the Lua core not to
free the various arrays created by lundump.c (strings, bytecode, lineinfo,
etc.) Perhaps this is as easy as setting the FIXEDBIT in the gc header.
Also, you need to dump strings complete with header space, and you cannot
store the bytecode array in ROM because the core needs to link the strings
into the string list. All these sort of details. Not too hard, I expect.