lua-users home
lua-l archive

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

On 4 June 2010 22:34, Alex Davies <> wrote:
> But what about:
> expectsfourarguments(returnsmanyarguments())
> The only solution I can think of is:
> local p1, p2, p3, p4 = returnsmanyarguments()
> expectsfourarguments(p1, p2, p3, p4)
> ... personally I greatly prefer the existing Lua way.

You're right, I hadn't thought of that case. How often does it come up?

I just feel a bit strongly about this because other than accidental
globals (which can be worked out with strict.lua, though it must be
disabled in release for performance), wrong number of arguments seems
to be a common cause of bugs (usually because someone is calling the
wrong function or misunderstanding it), and it doesn't always trigger
an immediate runtime error. It would also help catch mistakes between
. and : at call sites.