lua-users home
lua-l archive

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



I wasn't referring so much to 'string.gsub' but the fact that sometimes a functions return values are passed all, sometimes only one. I do _know_ how it goes, and so forth, but it certainly is a trap for newcomers.

Should we do a "Common Lua Pitfalls" :) list somewhere (the wiki?). That could help, since I don't have a better overall solution to recommend either.

-ak

7.9.2004 kello 10:56, Philippe Lhoste kirjoitti:

 I don't agree with Asko here.
I was struck more than once by this problem ;-) but I never thought "Aw, this language design is stupid" but instead "Ouch, I am stupid" :-P

I like this philosophy (returning as much info as possible/useful), consistent as David says. Making gsub (and other functions like find) returning only one parameter by default (the one we use the most) would need another parameter (a flag) or something like that. It would add some complexity, just to behave like a less capable language (C?)...

And if you don't like the way it behaves, it is so easy to create a new function matching your need, I don't see why you complain :-)

--
Philippe Lhoste
--  (near) Paris -- France
--  Professional programmer and amateur artist
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --