lua-users home
lua-l archive

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


On Mon, May 18, 1998 at 08:13:06AM -0300, Luiz Henrique de Figueiredo wrote:
> >From jeske@home.chat.net Mon May 18 03:15:20 1998
> 
> RI> It wouldn't be difficult to implement a built-in function "num_params",
> RI> which returns the number of parameters a function expects. However, it would
> RI> not work neither for C functions nor for vararg functions. So, it doesn't
> RI> seem very useful as a generic facility.
> 
> >It does seem odd just to throw away this information at compile time
> >though, given that it is there. Perhaps it would be worthwhile to preserve
> >this information for functions which make it available. Namely, a lua
> 
> The information about the number of parameters a function expects is preserved
> for run time, because it's needed for adjustment.

Did not know that. However, at the very least it does throw away the
_names_ of the arguments, correct?

> >grabbed by some fallback style function. So normally it would just get
> >trashed, but if you wanted to do something strange, you could hook the
> >"define function" fallback, and you would know all the arguments, and
> >their names.
> 
> Like I said, I don't see any need for a "define function" fallback,
> given the existence of the "setglobal" tag method.

functions arn't always setup as globals. However, I was more specifically
referring to a way to get enough information to recreate the function
"prototype" including the argument names.

I don't think I'd use it any, but it seems like it would be useful in
Steve's Lua graphical programming environment. (as I understand it) Right
now he has to exert facist control over entry of functions into Lua in
order to get this information. 

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net