[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Next Lua (5.2) feature request : slicing
- From: Mildred <ml.mildred593@...>
- Date: Tue, 21 Nov 2006 23:06:17 +0100
Hi,
Why do not add slicing in the next release of Lua ?
It could be for example :
tab[i:] equivalent to tab[i,false] or tab[i,nil]
tab[:j] equivalent to tab[false,j] or tab[nil,j]
tab[i:j] equivalent to tab[i,j]
And if the metatable __index is defined, it would be respectively
equivalent to :
metatable(tab).__index(tab, i, false)
metatable(tab).__index(tab, false, j)
metatable(tab).__index(tab, i, j)
And also create the _index metamethod in the string module, so this
could be used with strings. Then I could have instead of str:sub(1,2)
str[1,2] ... and instead of str:sub(2,2) str[2].
Any toughts about it ?
--
Mildred <xmpp:mildred@jabber.fr> <http://mildred632.free.fr/>
Clef GPG : <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]