[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Simple classes
- From: Jose Marin <jose_marin2@...>
- Date: Wed, 1 Jun 2011 03:43:54 -0700 (PDT)
Hi.
I need to define some classes hierarchy for my game, like in this pseudocode:
class Actor {
public:
virtual void update()
{
print("Actor::update");
}
};
class Soldier: public Actor {
public:
void update()
{
Actor::update();
print("Soldier::update");
}
};
Soldier soldier;
soldier.update();
This should print
Actor::update
Soldier::update
Is there any way of doing this in Lua?
I´ve found some links about OOP in Lua, but none seemed to be pratical/fast to be used in a game, also the call to the base class methods is a problem, too.
Thanks
Jose