lua-users home
lua-l archive

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



Face it, that looks really cryptical for the newcomer.

Personally, I would welcome select/case/default into the language, but then again, using lookups (in other ways than what you describe here) generally diminishes the need itself for a switch statement. But it wouldn't hurt, either.

-ak


1.9.2004 kello 18:00, David Given kirjoitti:

 I may be being a killjoy, but:

({
	[0] = function ()
		print(0)
	end,

	[1] = function ()
		print(1)
	end
}[value] or function ()
	print("default")
end)()