getSourceLine

getSourceLine() → integer line
Returns the number of the line where this call to getSourceLine is written, in the file that contains it (an included AI counts its lines from its own start). The number is set at compile time, so the call costs a single operation. Handy to locate a debug message: debug('line ' + getSourceLine()). Called through a variable (var f = getSourceLine), it returns the line of the statement making the call, for 100 more operations.

Returns the number of the line where this call to getSourceLine is written, in the file that contains it: in an AI included with include, lines are counted from the start of the included AI.

The number is set at compile time, so the call costs a single operation. Together with getSourceFile, it locates a debug message.

debug('line ' + getSourceLine()) // line 1
var enemy = getNearestEnemy()
if (enemy == null) {
	debugW(getSourceFile() + ':' + getSourceLine() + ': no enemy') // /ia/main:4: no enemy
}
Return
Note