question

Darryl M avatar image
0 Likes"
Darryl M asked Darryl M commented

Array as User Command return type?

The documentation says that Array is a valid return type for a User Command (see https://docs.flexsim.com/en/20.0/Reference/Tools/UserCommands/#parameters), but when I create such a User Command and then use it I get an error. Here is a line of code:

Array returned_array = UserFunctionThatReturnsArray();

and here is the error it gives:

Command UserFunctionThatReturnsArray does not return the required type.

Am I doing something wrong or is the documentation incorrect?

Incidentally there is a typo in that same section of the documentation:

The var parameter with will accept any of the datatypes.

FlexSim 20.1.0
user commands
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Darryl M commented

This looks like a bug. Thanks for pointing out this and the documentation typo. I'll add this to the dev list. Sorry for the inconvenience.

For now you can use the var return type to still return arrays.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Darryl M avatar image Darryl M commented ·

Changed the return type to var, it works great. Thanks.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.