[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: strings
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 16 Dec 2009 15:38:16 +0200
On Wed, Dec 16, 2009 at 3:29 PM, Hans Hagen <firstname.lastname@example.org> wrote:
> The following is valid lua
> a = "text"
> b = a
Yes, given that there is no index operator for strings it seems odd
that we don't get an error. The reason is that strings have a
metatable with __index pointing to the string table; looking up  on
s leads to string which gives the nil as you've noticed.
If you're prepared to modify the metatable of all strings, then you
can define a in this case to be a:sub(3,3)