lua-users home
lua-l archive

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

It doesn't have to be another file in the distribution.  I use bin2c (found in the etc folder of the Lua distribution) to convert my Lua files to C headers.  The Lua file is then compiled in with the rest of your code, so there is no extra file to worry about.  I also use luac to pre-compile the Lua files to slightly speed up load times.

On 6/19/06, Tom Miles <> wrote:

Um.  Yeah, I suppose I could actually.  But (and I'm only making excuses here), it would be another file to add to the distribution (which at the moment is just an exe).  But that is a bit lame :)

> -----Original Message-----
> From:
> [ ]On Behalf Of David Haley
> Sent: 16 June 2006 17:15
> To: Lua list
> Subject: Re: Implementing read only tables using C API
> Hi Tom,
> On this day of 6-16-2006 8:49 AM, Tom Miles saw fit to scribe:
> >
> > The reason I am doing this is to create a Lua script
> environment for
> > some end users.  The point of the exercise is to create a
> simplistic
> > environment in which they can write small lua script functions to
> > perform operations on C objects.  I could just cut and
> paste some Lua
> > code to do the job, but then every script that gets written
> (and there
> > are going to be lots) would need to import a library
> script.  I'm not
> > keen on that approach if it can be avoided.
> >
> Could you not load the script yourself (via a loadstring or
> dobuffer or
> similar) when you create the Lua_State from the C API? That
> way, it is
> imported, but the end-users don't have to worry about it. I
> don't know
> if it's the most elegant solution or the "Lua Way" of doing
> things, but
> I had a similar problem as you and this is how I solved it.
> Best,
> - David
> --
> ~David-Haley