lua-users home
lua-l archive

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


A quick frame of reference:
  I am a games programmer looking to use LUA to manage in game
cut scenes, mini quests, and probably some of the game AI.

So far LUA is looking very good on all fronts except one, which
I cannot find any answers for ..

What I have not been able to work out is, how do I time slice
the running on LUA scripts. ?

The setup I need would be something like (and this is very simplified)

Init Hardware
while (TRUE)
    process controllers.
    process game logic
    run 100 instructions of LUA Virtual Machine
    process sound
    render
end while

Specifically I would like to be able to pause/resume a running LUA
script or do something similar. (e.g. run for 100 LUA instructions then exit)

ps - It might appear from this setup, that running the game code from
inside LUA is the answer, but due to complications with interrupts, and
part of the processing being done on a different thread, that will be
somewhat impractical. The other reason I am not looking to run
everything from inside LUA, is that I would have to convince a large
team of programmers, why we have to fundamentally change the
way our engine is layed out.

So if anyone has any advice .. (like hopefully, which existing LUA
functions I need to call), it would be much appreciated