Can someone show me how to do the equivalent of this function in Lucee.
“pageContext” is not valid string to getDeclaredField() method.
<!---
Gets the path to the calling page.
--->
<cffunction name="getCallerTemplatePath" output="false" returntype="string">
<cfset var field = getMetaData(caller).getDeclaredField("pageContext")>
<cfset field.setAccessible(true)>
<cfreturn field.get(caller).getPage().getCurrentTemplatePath()>
</cffunction>
As you can see it does not have a field named pageContext, which explains the error message that you are seeing.
You have to always keep in mind that while Lucee does similar things as ACF, e.g. compile CFML to Java, etc., it does them differently. In this case you are looking for an internal variable of ACF in the Lucee code. You won’t find it.
If you have a valid use case then you can open a feature request/enhancement in the JIRA, and we can possibly provide a way to retrieve that information, but it would not be by adding a variable name to match the internal, undocumented, ACF code base.