[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: sunday afternoon whishlist
- From: "Alex Davies" <alex.mania@...>
- Date: Sat, 5 Jun 2010 10:34:57 +0800
This is definitely a valid use case, but checking for the correct
number of arguments would not limit lua in any way, nor prevent you
from doing this. Putting ... at the end of the argument list would not
only let you ignore irrelevant arguments, but serve as in-code
documentation that you are doing so.
Are you sure? It'd break a lot of existing code. And some cases would be
hard to fix.
ie, the simple case of:
expectsoneargument(returnstwoarguments())
is easy to fix:
expectsoneargument((returnstwoarguments()))
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.
- Alex