lua-users home
lua-l archive

Re: Accessing String contents

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

AltStyle によって変換されたページ (->オリジナル) /