new "empty" value/type in Lua?

classic Classic list List threaded Threaded
102 messages Options
1 ... 3456
Reply | Threaded
Open this post in threaded view
|

Re: new "empty" value/type in Lua?

Miles Bader-2
It feels a little weird for a primitive/fundamental operation like
that to require using a function from the "table" module, which is
otherwise sort of an optional add-on utility module...

-miles

--
Once, adj. Enough.

Reply | Threaded
Open this post in threaded view
|

Re: new "empty" value/type in Lua?

Roberto Ierusalimschy
In reply to this post by Luis Carvalho
> That's a good solution, and we could even avoid the metatable by making '#'
> and ipairs check table.n by default, similarly to Lua 5.0 (but without
> setlength.) In this sense a table is automatically a "simple" array just by
> setting 'n'.

There were good reasons we removed that from 5.0, let us not go back
again.  The originally proposed solution is simply a library stuff, with
mostly optional use. Making # look t.n by default is a change in the
guts of Lua.

-- Roberto

1 ... 3456