Luabind and passing classes

Nathaniel Lewis <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1279756432.9062.12.camel@XtremePC>
I was reading through some tutorials and I had a question unanswered.
How do I pass a specific class to Lua?  I have a class that represents a
world in my game engine and I need some way to talk with it from Lua.  I
think LuaBind is the answer but I don't know.  I would never want to
create the class from Lua.  Instead I would want to pass a reference to
the one created on the c++ side to Lua and then call functions inside of
it.  Is this possible with LuaBind?  Basically a simple script would
look like this

-- called when map is loaded by engine --
function Init (worldInstance) 
    -- do stuff --
end

-- called after every frame is rendered --
Update = coroutine.wrap( function (worldInstance, timeSinceLastFrame)
    while true do
	-- do stuff + call coroutine.yield() when waiting for things --
    end
end)
						Nathaniel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.