lua-users home
lua-l archive

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


2012/6/22 Peng Zhicheng <pengzhicheng1986@gmail.com>:
>
> right, strings are strings.
>
> in Lua, strings are not defined as arrays of characters(like C).

We have had this point before.
   <http://lua-users.org/lists/lua-l/2010-12/msg00525.html>

The post started like this:

> 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.

And Roberto replied:

> Thanks for the feedback. We will correct this statement. Strings in
> Lua clearly do not represent arrays of characters; people should
> expect s[i] = "x" to work too.

But that correction has not yet been made.