Case in Struct Definition vs Assignment
Jump to navigation
Jump to search
Description
When accessing struct members, the case of the word STRUCT/struct makes a difference. In fact, I had a failed API call and I couldn't figure out what was wrong for quite a long time.
Example code to demonstrate the bug.
Note case of STRUCT/struct. The first printout should read "3" but it reads as "0" when I run it.
STRUCT test, number as long
test.number.STRUCT=3
'the error shows in the following line:
print test.number.struct
Example code to work around the bug.
STRUCT test, number as long
test.number.struct=5
'this one prints correctly because the word "struct" has
'the same case structure; if any of the letters are of
'a different case then the one above where we set the value
'LB treats it as a different variable altogether
print test.number.struct