lua-users home
lua-l archive

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


Hallo,

Brenden Rheaume wrote:
I am beginning to imbed lua into a game project. One of the things that I would like to do is, define general functions(OnHit,OnDamaged,OnClick) for each object type in the game (each enemy, ship type, weapon type, etc), which would be defined in a lua script file for each type. What I need to know is how expensive would be to use multiple lua_States for each type, loading the lua script associated with each type, assumming there are quite a few of them (50+). If it would be really expensive (memory/cpu) to use that many lua_States is there another convienent way to acheive the same result?

Hum, why don't you put the functions for each type in a separate table inside the same lua_State? If you keep each type in a different lua_State they'll be completely unrelated.

-alex