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?

2
  • 2
    How are you defining myStruct? When I tried it, it worked as expected. This is CF10 though. pastebin.com/V8eVgW1x Commented Feb 23, 2012 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 }; Commented Feb 24, 2012 at 5:05

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.