lua-users home
lua-l archive

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

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:

is easy to fix:

But what about:

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