<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Inspecting UDT (Types) > UDT_ElementByte |
Description
Return the byte position of an element inside an UDT (User Defined Type) variable.
Syntax
lPos = UDT_ElementByte(UdtElement)
Returns
Number
Negative values means error, usually UDT element does not exists
Parameters
Name |
Type |
Optional |
Meaning |
UdtElement |
UDT structure |
No |
An UDT element name |
Remarks
First element in an UDT is at Byte 1
Restrictions
See also
Examples
Uses "Console"
Type tUDT
a As Byte
b As Integer
c As Long
End Type
Dim v As tUDT
v.a = 1
v.b = 2
v.c = 3
PrintL UDT_ElementByte(v.a), "(expected byte 1, as it is in the root)"
PrintL UDT_ElementByte(v.b), "(expected byte 2)"
PrintL UDT_ElementByte(v.c), "(expected byte 4)"
WaitKey