lua-users home
lua-l archive

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


> 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:
	http://lua-users.org/lists/lua-l/2001-07/msg00263.html

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.
--lhf