lua-users home
lua-l archive

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

>By making the script event driven. No "wait until this happens", 
>just a function called whenever it happens.

Or [which may be considered to be the same from another point of view] by
using state machines, where every NPC is a state machine that does just a
'small step' at every call from the main loop. Also, to make things
simpler, actual action could be done only from the main loop.
It is a bit more complex than having separate threads, but it usually is
more robust and easier to debug (things always happen in a known order). At
least that's my experience with industrial control applications.