lua-users home
lua-l archive

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


About s[i]:

> Funny, but I found myself wanting to type exactly that not an hour ago.
> I remembered that it wasn't the "Lua way," though, and stopped myself in
> time.
> 
> Would be nice if it worked, though.

It'd be nice, and it can be made to work with a suitable change in __index
in the string metatable, but it does not seem to be as useful as it promises:
how often do you scan a string byte by byte? What would be nice is if s[i,j]
was the same as s:sub(i,j), but alas there is no multiple indexing in Lua.