lua-users home
lua-l archive

Re: lua function arguments

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


>From jeske@home.chat.net Mon May 18 14:11:34 1998
lhf> The information about the number of parameters a function expects is preserved
lhf> 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?
not if $debug is on.
arguments are like local variables and these names are preserved when
$debugging information is requested.
>> 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.
again, if $debug is on, then everything is available.
luac uses this info for creating a listing:
20 function T(x,y,z)
21 local a,b
22 end
function defined at "t":20 (9 bytes at 100054f8); used at main+40
locals: x y z (a (b))
 0 05 STACK 5
 1 03 ARGS 3
 2 7B14 SETLINE 20 ; "t":20
 4 7B15 SETLINE 21 ; "t":21
 6 0101 PUSHNIL 1
 8 00 ENDCODE 
but of course, luac does use inside information not available in lua.h.
>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. 
For this kind of application, I think that inside information is ok.
--lhf

AltStyle によって変換されたページ (->オリジナル) /