lua-users home
lua-l archive

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


Hi Roberto!

Reading PiL3 I noticed that you don't introduce the `select` function
when you talk about vararg functions.

However you use it in two places, namely p.203 in the snippet:

    count = select(2, string.gsub(str, " ", " "))

and at p.205:

    nvow = select(2, string.gsub(text, "[AEIOUaeiou]", ""))

Was it an intentional omission? One of those "dark corners of Lua"
mentioned in the preface (p.xvi) which PiL3 skips over?

If this is the case (then I wonder why - I thought it was the natural
way to process varargs) may I suggest to consider adding a line of
explanation before using `select`. IMHO the novice reader could be
really confused since the only `select` that was mentioned before was
Luasocket's select (p.95). It's not at all apparent that `select` is a
Lua base library function, so she could have an hard time guessing
what's happening.


Cheers!

-- Lorenzo

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments