lua-users home
lua-l archive

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


Steve Dekorte wrote:
> David Jeske wrote:
> > ge_collision = function(self,number x,number y,Sprite whoIhit)...
> >
> > ...and now everyone knows exactly what object type "whoIhit" is.
> 
> You might try using a naming convention when the type isn't clear:
> 
> ge_collision = function(self, x, y,whoIhitSprite)
> 
> Or better yet:
> 
> function ge_collisionAtX_Y_with_(self, x, y, aSprite)
> 
> This way a developer who looks at the method's use doesn't has to look 
> at it's declaration to determine what the args are for.
> 
> Steve
 
Or just use some comments...

ge_collision = -- Event callback: Manage collision
function(
  self,   -- object
  x,      -- horizontal position
  y,      -- vertical posiition
  whoIhit -- Sprite
)

Of course, you must like this kind of style, and expect other programmers to
follow it.

-- 
--._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`--

Sent through GMX FreeMail - http://www.gmx.net