lua-users home
lua-l archive

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


Mark,

You're right.  I've only used Lua as an interpreter for .lua script files 
that are started from my main C++ app.  I want to build the .c file that 
would contain the bytecode for my compiled lua library functions and then 
include that in my VC project.

Your example assumes that I have an executable "lua.exe" available.  I have 
the 5.1 release.  Am I right in assuming that it is the luac.c file that I 
compile and link to build it - lua.exe?  What's the difference between the 
lua compiler and the lua interpreter and are they represented by different 
files in the downloaded source.

Ed

"Mark Edgar" <medgar123@gmail.com> wrote in message 
8e98b3970704271409ic4317dbr9ee60e8932a66a7c@mail.gmail.com">news:8e98b3970704271409ic4317dbr9ee60e8932a66a7c@mail.gmail.com...
> On 4/27/07, Edward Mitchell <emitchell@ieee.org> wrote:
>> Looks like just what I need.  I can compile srlua.exe and then give it 
>> the
>> bin2c.lua file to chew on which itself will chew on my +MyLibs.lua file 
>> to
>> produce an include with the characters for my library Lua code.
>
> If I understood your original question, you need a build tool which
> produces C files containing pre-compiled Lua chunks (scripts).
> Assuming you have the standard Lua interpreter available, you don't
> need srlua to run bin2c.lua at build time:
>
> lua bin2c.lua +mylibs.lua >mylibs.c
>
> Using srlua isn't necessarily wrong here; srlua is really useful for
> distributing or deploying Lua programs in situations where the
> standard interpreter isn't available or desired.  If you're going to
> be using bin2c only at build time, it doesn't make sense to add srlua
> to your project when the Lua distribution already includes lua.exe.
>
> If, on the other hand, you want to distribute bin2c.exe with your
> system, then srlua is just what you want.
>
>     -Mark
>