lua-users home
lua-l archive

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


On Wed, Jan 19, 2011 at 04:34, Enrico Colombini <erix@erix.it> wrote:
> On 19/01/2011 11.35, Steve Litt wrote:
>>
>> In general, when game programmers use C and Lua, to they fire up a C
>> program
>> that calls a Lua script, or do they fire up a Lua script that calls a C
>> program, or are both commonly done?
>
> In adventure games for a resource-constrained device, I used a simple C++
> scheduler (called from the frame loop) to launch or resume Lua coroutines,
> which in turn called back the C++ game primitives through a plain C
> interface. I kept game data on the Lua side.
>
> --
>  Enrico
>
>

I usually have a "bootloader" C program that creates a Lua state and
exposes some internals to it and lets it go nuts. A lot of my programs
however are a Lua script that loads a bunch of modules (some of which
are written in C); it's not infeasible that a game engine could be
done that way.

There is no best way, except whichever works best for you.

-- 
Sent from my toaster.