lua-users home
lua-l archive

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

On Feb 3, 2010, at 3:48 PM, Michal Kolodziejczyk wrote:

> Hello,
> is there any reasonable way to check, for a defined lua function, how
> many arguments it expects and what are their names? And how many
> arguments it can return?
> I would expect this from debug.getinfo(f), but its not there.

I believe the names of the arguments are available via getinfo except that you don't know which values are arguments and which values are locals. This would be nice to add since it would help with writing optimized wrappers. I looked at what it would take and it looked like the information is available internally.

The number of return values is not readily available though the compiler ought to be able to determine it (provided there's an "it varies" result which would also be needed for the number of arguments). Again, this would be useful for generating wrapper functions that don't just use ...