|
于 2012-7-19 9:31, Luiz Henrique de
Figueiredo 写道:
whow, I didn't realize that the parentheses can `increase' the number of values in a explist.Do you really want to write tostring() without arguments? What for?It is more as a failsafe for this kind of scenario: table.concat{stuff, tostring(foo()), ... } where foo is dynamic and may return nothing.In this case, if you know you have to protect yourself, use table.concat{stuff, tostring((foo())), ... } Note the extra pair of parentheses around foo(). I thought it could only `reduce' it. shame on me. I have read the manual, and found the manual said, > >In all other contexts, Lua adjusts the result list to one element, discarding all values except the first one. > I am thinking it might be better saying "...to one element, either discarding all values except the first one if the explist is non-empty, or giving a single `nil' value otherwise." |