lua-users home
lua-l archive

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

Ross Bencina wrote
> On 13/06/2014 4:13 PM, Thomas Jericke wrote:
>>> I'll leave it to others to determine whether using string literals in
>>> an interface is ever good style.
>>> Ross.
>> [...]
> You're intentionally twisting my words.
> It's one thing to be able to use a string literal, quite enough to 
> require its use in an interface.
> We're not talking about module or function names here, we're talking 
> about constants that are usually integers.
> Ross.

Lua's own APIs use string literals for constant 'enum' values. Some examples
of functions that do this are collectgarbage, select, type, io.type,, and coroutine.status (there are several more.)

IMO it's quite an acceptable idiom in Lua code. LÖVE[1] uses string literals
for all of its many 'enum' constants.


View this message in context:
Sent from the Lua-l mailing list archive at