lua-users home
lua-l archive

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

On Thu, Jun 21, 2012 at 9:15 AM, Michal Kottman <> 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.