lua-users home
lua-l archive

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


Hey there Lua fellows!

First e-mail I'm sending to the list - I hope this is not a repeated question, I searched through the archive and couldn't find what I'm looking for.

So.. I've built a game engine in C++ and I have a GameObject class that represents all the objects in my game, now I have some other classes that derive from GameObject, such as Robot, Bullet, Player, etc...

What I'd like to do is to extend the GameObject class in Lua instead of making C++ derivatives, to keep the engine as clean and simple as possible.

The Lua object should have awareness of it's own type, and state. For instance, the 4 callbacks that will make the object "tick" would be Construct, Destruct, Update, Collide -> these will be implemented in Lua. These methods should be able to call getLinearVelocity, getPosition, applyForce, etc... that will be implemented in the game engine. All of these method should work on the context of the same instance.

What is the best approach for doing what I described?

Appreciate your help!

Thanks,
Guy