lua-users home
lua-l archive

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


 > How hard is it to add a switch statement to lua. Currently I am
 > using if then elseif statements - switch case statements would
 > be more efficient and also more readable.

It's pretty easy --- I posted patches to this list a year or two ago,
but they are for Lua 2.5.  The results are much more readable but not
more efficient---because I wanted to switch on arbitrary values,
especially strings, the switches are implemented much as a sequence of
if-then-elses.

Norman