[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table insertion [was: Lua 5.1 (work2) now available]
- From: David Burgess <dburgess@...>
- Date: Fri, 5 Nov 2004 11:48:50 +1000
Interesting set of responses. I missed most of it due to time zone.
If I may try to summarize the suggestion range that appeals to me:
I like (mostly for the previously stated reasons) -
a) t[] = val as (table and string) append
b) t = t .. value (because of similarity to string concat operater)
c) a meta method for table append
d) t[] returning length (of both table and string)
e) 5.1 getn behaviour rather than 5.02 getn
re: strings
I recall from a language in a faraway OS and a faraway time a string
syntax that allowed
s[n,m] where
n=start pos, m=length
both n & m could be -ve which meant from the end of the string
which gave
s='abcdefg'
s[2,2] == 'bc'
s[2] =='b'
s[2,-1] == 'bcdefg'
s[-1] = 'g'
s[-3,-2] = 'ef'
n = start position
I used this a lot (many years ago) and found it convenient.
(It was an OS called Pick for the curious)
DB