[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Any thoughts on indexing ...?
- From: Asko Kauppi <askok@...>
- Date: Wed, 9 Apr 2008 10:20:29 +0300
luaSub has a syntax mod exactly like your proposal (used by 'luas -
-- SELECT syntax mod Copyright 2006-08 Asko Kauppi
-- Simplifies the 'select' usage a bit, making it look less like a
-- #... -> select('#',...) number of values in ...
-- ...[n] -> (select(n,...)) value #n of ...
-- Note: 'select(n,...)' is still used explicitly when wanting all
values-- from 'n' onwards.
Alex Davies kirjoitti 9.4.2008 kello 9:38:
Just wondered if the following syntax is being considered at all:
for i = 1, #... do
Imo it seems a natural extension, and less cumbersome then:
local select = select
for i = 1, select("#", ...) do
And would of course be orders of magnitude faster for large varargs.
It would also allow writing select in pure lua, something which is
Still, I can see that some people may not like the syntax, just
wanted to throw it out
P.S. I do realise it's a little inconsistent, as true lists will
never be indexable... eg:
local a = (1, 2, 3)