Description
Returns an array of structs. Each struct contains template name, line number, and if applicable the function name.
History
ColdFusion 10: Added this function.
Returns an array of structs. Each struct contains template name, line number, and if applicable the function name.
ColdFusion 10: Added this function.
callStackGet(__)
Callstack is a snapshot of all function calls or invocations. For your ColdFusion application, callstack provides the template name, line number, and if applicable, the function name.The feature is helpful in scenarios where you want to track the recursive calls that you made. For example,
In this example, the factorial of a number is computed.Here,
And so on, for other values of n
callfact.cfm
<cftry> <cfinclude template="fact.cfm"> <cfcatch type="any"> <cfoutput> #cfcatch.message# <br>#cfcatch.detail# <br> </cfoutput> </cfcatch> </cftry>
<cfscript> numeric function factorial(n) { if(n == 1) { writedump(callStackGet()); writeoutput("<br>"); return 1; } else { writedump(callStackGet()); writeoutput("<br>"); return n * factorial(n - 1); } } factorial(5); </cfscript>