lua-users home
lua-l archive

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


On 29 June 2016 at 10:10, Philipp Janda <siffiejoe@gmx.net> wrote:
> Am 26.06.2016 um 21:59 schröbte Philipp Janda:
>>
>> Am 26.06.2016 um 20:23 schröbte Tim Hill:
>>>
>>>
>>> As I said, the scheme is far from perfect, but it’s more consistent
>>> that the current incoherent approach of .n, # and sequences imho.
>>
>>
>> I agree. Most of it could be realized via a library without support from
>> the Lua core ...
>
>
> I've modified the standard table library to use `.n` instead of `#`. In case
> someone else wants to check out how it feels:
>
>     luarocks install --server=http://luarocks.org/dev table.n

>From reading test.lua, the feeling I get is that it feels cumbersome
if t={1,2,3} doesn't work with the `table` functions out of the box. I
wonder if "use n if present, or else just use #" would be a sensible
approach. For the standard library, I think it would be confusing (and
perhaps too slow?) in general, but it would make sense for
table.unpack.

-- Hisham