[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re:Q: A way to determine if function is defined [repost]
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 14 Mar 2000 10:42:30 -0300 (EST)
listproc choked in this one. --lhf
>From Paul_Winwood@sw2000.com Tue Mar 14 09:20:57 2000
>Date: Tue, 14 Mar 2000 12:18:55 GMT
>From: "Paul Winwood"<Paul_Winwood@sw2000.com>
>To: <lua-l@tecgraf.puc-rio.br>
>Subject: Re:Q: A way to determine if function is defined
Hi,
Assuming that I understand your question correctly then
I use the built in function 'type' which returns the type of
the referenced object which for a function is the string 'function'.
for example consider the following LUA fragment:
function named()
end
-- note: noname is not declared.
write("type of 'named' is "..type(named).."\n")
--> returns type of 'named' is function
write("type of 'noname' is "..type(noname).."\n")
--> returns type of 'noname' is nil
Regards,
Paul.
____________________Reply Separator____________________
Subject: Q: A way to determine if function is defined
Author: <lua-l@tecgraf.puc-rio.br>
Date: 14/03/2000 08:32
Hi everybody,
Is there a method in Lua to check from within a script if the function is
defined?
I mean, before "call expression not a function" error appears.
What I figured out, is trying to invoke the function in question using
"call", providing own handler.
Does anybody know nicer solution?
Maciej