lua-users home
lua-l archive

Re: Changing syntax

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


On Thu, Feb 12, 2004 at 10:10:34AM -0600, Virgil Smith wrote:
> is simple enough, however, how would one implement the equivalent of...
> 
> select case(x)
> {
> case 1,2: ...
> case 3,7: ...
> case 9: ...
> case else: ...
> }
Or maybe
case(x){
 [{1,2}] = function() ... end,
 [{3,7}] = function() ... end,
 [9] = function() ... end,
 [false] = function() ... end
}
Alas, implementation becomes quite inefficient, and this won't work
if x is allowed to be of any type.
-- 
Tuomo

AltStyle によって変換されたページ (->オリジナル) /