Page 1 of 1

How can I tell if a function exists?

Posted: 11 Jul 2021, 17:19
by arcticir
I use the H version of the addScript function, which automatically generates functions.
Before calling a function, it will use isfunc("__func_" fn_id) to judge, if not, then use addScript to generate this function.
However, in V2-138, I tried various methods that generate an error: "Error: Variable not found."
type(__func_%fn_id%)
isset(__func_%fn_id%)


I tried using "#Warn All, Off" with no effect either.
How do I turn off the error reporting, or how do I determine if the function exists?

Re: How can I tell if a function exists?  Topic is solved

Posted: 11 Jul 2021, 17:58
by Onimuru
I would just use a try/catch block for that.

Re: How can I tell if a function exists?

Posted: 11 Jul 2021, 19:17
by arcticir
Onimuru wrote:
11 Jul 2021, 17:58
I would just use a try/catch block for that.
Thanks.