[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: extension for lua bytecode files
- From: Thomas Lauer <thomas.lauer@...>
- Date: Sat, 16 Jun 2007 17:59:37 +0100
Tony Finch <email@example.com> wrote:
> Is there a standard extension for Lua bytecode files? I've been using .luo
> (short for Lua object code).
I don't think there's a standard. FWIW, I use .lbc but .luo sounds
> I'm writing a program that embeds Lua and which will have significant
> parts written in Lua. In order to make it easier to deploy I'm embedding
> the bytecodes in the executable, which I am doing by a .lua -> .luo -> .c
> translation. The C file just declares an array and initializes it with
> the contents of the Lua bytecodes so it can be passed to luaL_loadbuffer.
> I guess lots of people do something like this?
This works very well. I have a 'shell' along the lines of lua.c which
loads three or four byte-code libraries either from internal byte arrays
or from external .lbc files.
Just watch out for strlen() and friends ... there's a function in lua.c
that calls this before loading the buffer. That's fine if the string is
text but if it's precompiled byte code strlen() just won't cut the
web : http://thomaslauer.com/start