1

When I pass a struct to a function that is expecting a struct, the function is nested inside another struct.

For example:

function getAnswerFromSO(struct question=StructNew()) {
   writeDump(arguments.question);
}

CallinggetAnswerFromSO(question=myStruct); results in

question {
  myStruct = {
     text = 'foo',
     subj = 'bar',
     user = 1 }
};

** Obviously, this is not what a cfdump output looks like, but it illustrates the issue just the same.

Is there a way to prevent this nesting?

RHPT
  • 2,560
  • 5
  • 31
  • 43
  • 2
    How are you defining myStruct? When I tried it, it worked as expected. This is CF10 though. http://pastebin.com/V8eVgW1x – Raymond Camden Feb 23 '12 at 23:24
  • 1
    I'm a fool. I was creating the struct like so: myStruct { mystruct.text = 'foo',mystruct.subj='bar',mystruct.user=1 }; – RHPT Feb 24 '12 at 05:05

1 Answers1

1

I can confirm that Ray's example works on CF9 as well.

commadelimited
  • 5,656
  • 6
  • 41
  • 77