« MBS FileMaker Plugin,… | Home | MBS FileMaker Plugin … »

Tip of the day: Calling function name

Just talked today about how to know the calling function name. Solution can be to ask this by getting call stack. So here a code snippet:
Function CallingFunction() As string // Query name of calling function of a function #Pragma BreakOnExceptions false try // raise a dummy exception dim r as new NilObjectException raise r catch x as NilObjectException // get stack dim stack() as string = x.Stack // pick function name and return dim name as string = stack(2) Return name end try End Function
The name is encoded name including parameter hints for the compiler.
25 09 16 - 21:18
three comments

We can also use CurrentMethodName if parameter info is not necessary.
Jeremie LEROY - 26 09 16 - 00:06

Well, CurrentMethodName is current method name, but CallingFunction is caller function name.
One item previous in the call hair.
Christian Schmitz (URL) - 26 09 16 - 07:12

I didn’t realize this was one item previous in the call stack. This can be very useful, thanks Christian
Jeremie LEROY - 26 09 16 - 18:38

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.