for
stuff(x).var1 = "var1"
stuff(x).var2 = var2
stuff(x).var3 = var3
next
This would move the literal string "var1" into stuff(x).var1, the integer var2 into stuff(x).var2 (which is what we want), and the float, truncated(cutting off everything after the decimal) to an integer, var3, into stuff(x).var3 .
To make sure this is clear, typing
"Type UDTtest
var1 as string
var2 as integer
var3 as float
endtype"
will not make the actual variable var1 a string, etc. Just when it is used in an array, so stuff(x).var1 will be a string.
By default, all variables with no signs after them are integers, so var1, var2, and var3 would all be integers.
If you want var1 to hold the contents of a string, you would need to do something like "var1 as string" outside the type structure. You would also need to do "var3 as float" outside the type structure to specify that var3 is a float. Alternatively, you could use var1$, var2, and var3#. This is because the $ sign makes the variable a string by default and the # sign makes the variable a float by default. Then all you would need to do is load the string into var1$, integer into var2, and float into var3#, and then do:
for x=1 to 2
rem load correct values into var1$, var2, and var3#
stuff(x).var1 = var1$
stuff(x).var2 = var2
stuff(x).var3 = var3#
next
Also, the $ and # signs make it easy to see what the type of variables are, as all variables that end in $ are strings, etc.