lua-users home
lua-l archive

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


> For a long time, I have been able to stick with the conventions 
> inherited from ruby: PascalCase for classes, under_score for all the 
> rest... What is your advice ? Is there any "native" style for Lua?

The native Lua style is to combine multiple words into one identifier
without underscores, casing or any other reading signs, for example
getmetatable() and math.randomseed(). In fact there are no underscores
or uppercase letters in the Lua standard library except for stuff like
_G and _VERSION!

This style works okay for the Lua standard library but IMHO it can't
easily be applied to any given API. My advice would be to stick with the
style you like best and be consistent in using it..

 - Peter Odding

PS. For what it's worth, the Lua/APR binding uses underscores to
separate words and doesn't contain any uppercase letters, this style is
mostly inherited from APR and related libs (basically Apache style).