デフォルトでは、ColdFusionは単純な型(数値、文字列、GUIDなど)を値で関数に渡します。簡単な型を参考にして渡したいのですが。
私は現在、構造体で単純な値をラップしています(それらは参照によって渡されます)。これは私の問題を解決しますが、それは非常に醜いです:
<!--- TheFunctionName---->
<cffunction name="TheFunctionName">
<cfargument name="OutVariable" type="struct">
<cfset OutVariable.ID = 5>
</cffunction>
<cfset OutVariable=StructNew()>
<cfset TheFunctionName(OutVariable)>
<!--- I want this to output 5--->
<cfoutput>#OutVariable.ID#</cfoutput>
私はむしろこのようなものが欲しいです:
<!--- TheFunctionName---->
<cffunction name="TheFunctionName">
<cfargument name="OutVariable" passbyref="true">
<cfset OutVariable = 5>
</cffunction>
<cfset TheFunctionName(OutVariable)>
<!--- I want this to output 5--->
<cfoutput>#OutVariable#</cfoutput>