This works (assignment to an explicitly named array cell):

  <cfset ary = ArrayNew(3)>
  <cfset ary[1][1][1] = 99>

This works (assignment to a dynamically referenced scalar variable):

  <cfset scl = "scalar">
  <cfset "#scl#" = 99>

This (assignment to a dynamically referenced array cell) throws an error:

  <cfset ary = ArrayNew(3)>
  <cfset tst = "ary[1][1][1]">
  <cfset "#tst#" = 99>

It says: The string "ary[1][1][1]" is not a valid ColdFusion variable name.

Well, clearly that's incorrect, because it works in the first example. I
guess array cells are a special case.

I'm trying to find a way of assigning values to arbitrary cells in an array
with an arbitrary number of dimensions. Is there a way round this or should
I just store the data in nested structs instead?

TIA

Nick
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to