Re: orif
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: orif
- From: Dirk Laurie <dirk.laurie@...>
- Date: 2015年8月14日 20:56:04 +0200
2015年08月14日 20:48 GMT+02:00 Andrew Starks <andrew.starks@trms.com>:
> Points + AND - for being clever, though. This is one of the times when
> I *feel* like I'm inefficient in lua:
>
> local the_type = type(foo)
>
> if the_type == 'table' then
> --- something
> elseif type == 'number' then
> --- blah
It's verbose but clear. Lots of ways to obfuscate it. E.g.
({table = function() something end,
number = function() blah end})[the_type]()
I love Soni's suggestions. They make me appreciate how much
thought the Lua team have put into making the language lean
but powerful, concise but expressive, subtle but logical.