[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What is a Lua string? (Was: String indexing again)
- From: Michal Kottman <k0mpjut0r@...>
- Date: Tue, 21 Dec 2010 12:14:03 +0100
On Tue, 2010-12-21 at 10:20 +0200, Dirk Laurie wrote:
>
> One could, though, make s[k] mean "a one-byte string consisting of
> the
> k-th byte of s", i.e.
> s[k] == string.char(string.byte(s,k,k))
> Then it is obvious that "s[3]='c'" is nonsense, since
> string.char(string.byte(s,3,3)) = 'c'
> is nonsense.
Why not just string.sub(s,3,3)? :)