My engine uses a component-based entity system internally, and I want to bind it to Lua for scripting.
Now, I want to save people who write scripts for it typing work. In C++, to set the position of an entity, you'd do the following:
pEntity->GetComponent< CPoint >()->SetPos( Vector( X, Y ) );
That means, if I'd bind it to Lua 1:1 you'd also have to:
ent:GetComponent( CP_POINT ):SetPos( 123, 456 )
But let's be honest, would you want to type so much just to set an entities' position?
I don't think so, that's why I "hid" the component system from Lua:
Right now, what you do is
ent:SetPos( 123, 456 )
The component stuff is handled internally. You can still manually add and remove components from Lua with ent:AddComponent and ent:RemoveComponent, etc.
Now, this doesn't seem perfect either:
The Entity metatable gets cluttered because it has to take all functions of all components
ent:SetJointMotorEnabled()again seems kind of bad
Do you have any ideas how I could find a better naming scheme for component functions, without risking the scripting comfortability?