FUNCTIONS CORE

ProcLine()

Return the source line number of a call in the call stack

Syntax

Signature
ProcLine( [nLevel] ) --> nLine

Arguments

nLevel

is the number of steps up the call stack. 0, the default, is the current routine, 1 is the routine that called it, and so on.

Return value

An integer with the source line of the call that the routine makes, or 0 when nLevel is above the first routine of the program.

Description

Without an argument, the compiler embeds the line of the ProcLine() expression. With nLevel, the line is read from the call stack at run time: for level 1 it is the line where the caller called the current routine.

Notes

The example prints the line number and then .T.

Example

ProcLine.prg
PROCEDURE Main()

   LOCAL nLine := ProcLine()

   QOut( nLine )
   QOut( nLine > 0 )

RETURN

Output

50
.T.

See also