lua-users home
lua-l archive

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


It was thus said that the Great John Hind once stated:
> >Peter Melnichenko <mpeterval@gmail.com> Sat, 22 Aug 2015 09:54:16 +0300
> 
> This suggests that Lua ought to support index operation on strings now we
> are encouraged to
> see them as byte streams. It's easy to add this to the metatable, but if Lua
> did it natively, then
> this kind of expression could be pure (not involving function calls) and so
> more efficient.

  There's a problem though---sometimes, for strings that are just binary
data, you want to index them byte by byte, but for strings as text, you
might instead want to go through code point by code point (which might be
more than one byte).

  -spc (Perhaps another argument for metatable per value?)