lua-users home
lua-l archive

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


On Jun 13, 2014, at 1:32 PM, Tomas Guisasola Gorham <tomas@tecgraf.puc-rio.br> wrote:

> 	I don't need switch:
> 
> local event_handler = {
> 	MOUSECLICK = function (...) ... end,
> 	KEYPRESS = function (...) ... end,
> 	...
> }
> ...
> local callback = event_handler[x]
> if callback then
>  callback(...)
> end
> 
> 	Don't you use that kind of construction?
> 
> 	Regards,
> 		Tomás

Tomás, please see earlier posts on this thread that discuss the differences between switch statements and function-table constructs so the conversation doesn't go in circles! 

Also no, I do not use that type of construct, I much prefer the cleaner style of the switch statement and the extra functionality it can provide... which is why I created the switch patch! ;)

~pmd