lua-users home
lua-l archive

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


Hello all!

I am considering using Lua in my next game project. One of the approaches I
am exploring is to have multiple lua_States, one for each of the game
entities. This would allow my designers/script writers to have a private
namespace for each entity.

I can't seem to find the overhead cost for this implementation.

Also, I am intriqued by the way that that Lua retains function definations
after a lua_dofile call. Consider the following entity script:

-----------------------------------------
function entity_init()
    -- some init code
end

function entity_update()
    -- update handling code
end

function entity_event()
    -- Some event handler here
end


print("Entity Init Script complete")
-----------------------------------------

When I run this script, I get the ("Entity Init Script complete") message,
and I can then call any of these Lua functions from the C++ code.

What is the overhead for this functionality?


Thanks in advance!

Mark Manyen
Magic Lantern Playware (www.mlantern.com)