Function in DesignScript showing wrong results

Hi! I am quite new to Dynamo and DesignScript, but I am writing my master’s thesis on that subject and I got stuck. After realising I have too much of a repetitive code, I tried to use a function for the first time. Can somebody please explain to me, why in this case the function is showing different results than the same code written outside the function? I used the exact same input data. I am attatching the screenshot of the issue.

Thank you in advance!

It’s hard to say without seeing the inputs which you’re providing, as lists and dictionaries will process differently in a function than in a standard node, the list will be treated as a single object.

1 Like

Don’t know if this helps, but these are the inputs. Results.GetInternalForceAt() command comes from an external FEM package created by my professor, it returns a dictionary of internal forces values in each part of the chord.

It has something to do with the lacing and lists being provided, but I can’t see which and as I do t have FEM I likely can’t help much directly.

Try explicitly calling out the input types for your function as variableName: dataType [] if it is designed to work on a list input.