lua-users home
lua-l archive

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

> >   string.reverse (s)
> >     returns a reversed copy of string 's'
> This one is very strange...
> Can somebody give me a real-world use case where this function is so 
> useful that it needs to go in a standard library? I can't think any 
> practical use myself. Perhaps it is a temporary test function?

I had one use for this: when then mailing list was run by a Lua script,
I needed to group all subscribers from the same domain, to allow less
sendmail connections. To do that, I sorted the subscriber data base by
reversing the addresses, sorting, and reversing them back again.

But I admit it is a special application. I'm not sure string.reverse was
included because of that. In any case, it is easy and efficient to write
in C and very inefficient in Lua.

> I would rather see a string buffer library added to the standard
> library.

That'd be nice.