News:

  • October 13, 2025, 05:46:13 PM

Login with username, password and session length

Author Topic: Indirect Referencing of UDT's  (Read 2043 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Indirect Referencing of UDT's
« on: November 11, 2019, 06:56:08 AM »
Is there any way to reference a UDT field indirectly? For example (see attached photo) I have a UDT named MP. There are 8 instances of this UDT and I know that the UDT can be referenced indirectly like this: MP[0-7], to reference MP0-MP7. Is there any way to extend this indirect referencing down to the field level? For example, if I wanted to access the third field of MP0, is there some way to do this indirectly. Is there something like: MP[0].[2] to access MP0.WP, or MP[1].[4] to access MP1.HSHIGH?

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Indirect Referencing of UDT's
« Reply #1 on: November 11, 2019, 09:47:22 AM »
I think the way that I do it is you have to do an intermediate step and memcopy that instance to a flat int, real or bit array, then you use casting to choose what you want.
« Last Edit: November 11, 2019, 10:14:49 AM by ATU »

RBPLC

  • Hero Member
  • *****
  • Posts: 585
Re: Indirect Referencing of UDT's
« Reply #2 on: November 12, 2019, 05:05:58 PM »
Looks like it can be done but I was hoping there was a direct way to do it.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6126
  • Yes Pinky, Do-more will control the world!
Re: Indirect Referencing of UDT's
« Reply #3 on: November 12, 2019, 05:15:18 PM »
Looks like it can be done but I was hoping there was a direct way to do it.

Sorry, no. There are massive amounts of potential fail with each index pointing to a different/unknown/changing data type.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO