[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Accessing String contents
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 21 Jun 2012 10:19:43 +0200
On Thu, Jun 21, 2012 at 9:15 AM, Michal Kottman <k0mpjut0r@gmail.com> wrote:
> print(("hello world"):sub(7)[3]) --> r
And the point would be, that you can get Lua to do just about anything
you like, at some performance cost. The sugar s[i] for accessing the
'character' at the ith index now slows down all string method lookups.
Personally I feel it's best to keep using s:sub(i,i) because then
you're always aware of the cost of creating a substring.
steve d.