[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String represents arrays of characters.
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 13 Dec 2010 19:03:45 -0200
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.