lua-users home
lua-l archive

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

On Tue, May 22, 2012 at 6:32 PM, Coda Highland <> wrote:
> On Tue, May 22, 2012 at 7:18 PM, Rena <> wrote:
>> I'm writing a Lua module in C, but I want to store some Lua code in it
>> as well to perform some initialization, and use lua_load() to run it
>> as needed. However, I'm wondering about the best way to store this
>> code.
>> If I store it compiled, it may not work, because the bytecode format
>> differs from one system to the next, correct?
>> But if I store it as text, it requires the compiler, which may not be
>> available e.g. in embedded systems?
>> How does lua_load() react if Lua was compiled without the ability to
>> compile code? Is there a reliable way to embed Lua code in a C
>> library?
> My gut reaction is to add the Lua bytecode compiler into the build
> process of your application, so that the bytecode is generated at
> build-time, so it always matches the Lua library being used to execute
> it. Package the resulting bytecode into your application using
> whatever resource scheme you prefer.
> /s/ Adam

That sounds reasonable. Thanks for the input.

Sent from my Game Boy.