getSourceFile

getSourceFile() → string path
Returns the absolute path of the file where this call to getSourceFile is written, in the form accepted by include and fileRead (for example /lib/move): in an included AI, it is the path of the included AI. The path is set at compile time, so the call costs a single operation. Together with getSourceLine, it locates a debug message: debug(getSourceFile() + ':' + getSourceLine()). Called through a variable, it returns the file of the statement making the call, for 100 more operations.

Returns the absolute path of the file where this call to getSourceFile is written, in the form accepted by include and fileRead, for example /lib/move: in an included AI, it is the path of the included AI.

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

// In the file /lib/move
function moveSafely(cell) {
	if (getMP() == 0) {
		debugW(getSourceFile() + ':' + getSourceLine() + ': no MP left') // /lib/move:4: no MP left
		return
	}
	moveTowardCell(cell)
}
Return
Note