Overriding property setters
"Thomas Nelson" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <6F5D94EEE5B24BB9A96839D3C2066F90@Spawn> |
Is there a way to provide an alternate function binding for property
setters?
(please excuse the abbreviated pseudocode)
I would like to do something like this in Lua:
Obj.Position = Vector(0,10,0);
Obj.Position = Velocity(Vector(0,0,-15));
In the c++:
_class<Object>
[
.property("Position", &Object::getPosition, &Object::setPosition)
]
class Velocity: public MovementPolicy
{ // details about moving at a constant velocity.
}
Vector Object::getPositon()
{ // return my position
}
Object::setPosition(const Vector &pos)
{ // set my position
}
Object::setPosition(const MovementPolicy *pPolicy)
{ // do the stuff that will move my position every frame.
}
--
Thomas Nelson [email protected]
--------------------------------------------------------------
"If you still have gas, you're not lost".
- French explorer Pierre Frontage.
(M.Frontage was so influential in the exploration of North America many
roads are still named after him.)
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge