[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string's metatable?
- From: Rici Lake <lua@...>
- Date: Sat, 20 Aug 2005 09:58:57 -0500
On 20-Aug-05, at 5:55 AM, PA wrote:
Hello,
Using Lua 5.1 (work6).
Is the string's metatable here to stay? Can I confidently convert from
'string.len( aString )' to 'aString:len()' syntax?
I think you can even use #aString with some confidence :)
If the string's metatable is a permanent feature, what is the
recommended way to add new functions to it?
As far as I can see, just them to the string table:
string.StartsWith = StartsWith
It's the same table.
Finally, should the metatable be available to string literals?
"aString":lower()
You have to put parentheses around a string constant for this to be
valid syntactically:
("aString"):lower()