[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String represents arrays of characters.
- From: Tim Mensch <tim-lua-l@...>
- Date: Mon, 13 Dec 2010 13:53:34 -0700
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.
Tim
On 12/13/2010 1:44 PM, Dirk Laurie wrote:
> The title of this post is a quote from the Lua Reference Manual,
> Section 2.2 in Lua 5.1, Section 2.1 in Lua 5.2. Stare at it
> again.
>
> String represents arrays of characters.
>
> In the light of that statement, one can't be blamed for expecting
> that s[i] means the i-th character of a string. At present, s[i]
> is nil, even if i is in the range 1 to #s -- another gotcha.
>
> In some previous threads, various ways to achieve this in Lua were
> suggested. I was flamed for "writing a dialect" and failing to
> think in Lua instead of Pascal..
>
> But really, if Roberto himself says "String represents arrays of
> characters" then it can't be un-Lua-like to wish to write s[i].
> And who knows? It may yet sneak into a future Lua ...
>
> Dirk
>