Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to check to see if a VBScript function is defined?

This is probably just wishful thinking...

Is there any way to check to see if an ASP/VBScript function is defined before calling it?

like image 850
Matthew Cole Avatar asked May 28 '09 15:05

Matthew Cole


1 Answers

Here is my solution which works on the same principle, but the hacky-ness is pretty self-contained:

Function FunctionExists( func_name )
    FunctionExists = False 

    On Error Resume Next

    Dim f : Set f = GetRef(func_name)

    If Err.number = 0 Then
        FunctionExists = True
    End If  
    On Error GoTo 0

End Function 
like image 110
Tristan Havelick Avatar answered Sep 19 '22 18:09

Tristan Havelick