lua-users home
lua-l archive

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


On Mon, Dec 20, 2010 at 12:04 AM, Axel Kittenberger <axkibe@gmail.com> wrote:
> Changing the meta table of string is OK for the one main application,
> but a no-go for any library, or a script among several possible
> equals.

Yes, it's the 'global changes needed to provide local syntax' problem.
Because everyone will have their own idea of how to modify the string
metatable. Then s[i] could mean the substring or the character code,
depending on which library got loaded first.

I was once very fond of the idea of overloading __call for strings, to
be a sub replacement, but I really can't see it now as good
engineering practice.

As for COBOL: well, it would be something like EXTRACT ITEM I FROM STRING S ;)

Lua strings are not containers for characters. It's easy enough to
create a special type for that if needed.

steve d.