[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua function arguments
- From: lhf (Luiz Henrique de Figueiredo)
- Date: Thu, 14 May 1998 06:40:21 -0300
>From email@example.com Thu May 14 02:43:03 1998
>I may have asked this before, but is there any way to ask Lua for the
>number of arguments that a given Lua function expects?
no. the number of arguments that a function expects is not a notion in Lua.
what do you need this for?
there are ways to fake this, however.
you can create a table with the number of args plus the functions itself,
and use tag methods to aloow the function to be called directly and at the
same time check the number or do whatever you want to do:
function f(x,y) ... end
f(a,b,c) -- this gives an error
f(a,b) -- this is ok. the tag method uses 'call'.
something like this.