I have been playing with the following script in an attempt to generate the various var types, but do not know how or just can't make them exist.

I did notice that when the UDF is used as an "expression" to be displayed with types Object or Variant a script error occurred.

When it is a Boolean, @Error is set to zero.

All of this can be avoided if all UDF's that return a value send that value to a variable.

There seems to be a bug or deficiency when non-(string or numeric long) var types are treated as "expression" when coming out of a UDF.

If you can fix the code below to generate more VarTypes, the output may be interesting.

code:
Function UDFthingy($i)
Dim $i, $var

Select
case $i=0
$UDFthingy = $var ;Empty
$z=1
case $i=1
$UDFthingy = "" ;Null
$z=1
;case $i=2
; $UDFthingy = 1 ;Integer
; $z=1
case $i=3
$UDFthingy = 11111111 ;Long Integer
$z=1
case $i=4
$UDFthingy = 1.1 ;Single-Prec
$z=1
;case $i=5
; $UDFthingy = ;Double-Prec
; $z=1
;case $i=6
; $UDFthingy = ;Currency
; $z=1
;case $i=7
; $UDFthingy = ;Date
; $z=1
case $i=8
$UDFthingy = "Some Text" ;String
$z=1
case $i=9
$UDFthingy = GetObject("WinNT://@wksta/Administrator,user") ;Object Handle
$z=1
;Reason: Script error : Error in expression: Dispatch pointers not allowed in expressions. !
case $i=10
$UDFthingy = 1/0 ;Error
$z=1
case $i=11
$UDFthingy = exist("blah") ;Boolean
$z=1
;case $i=12
; $UDFthingy = ;Variant
; $z=1
;case $i=13
; $UDFthingy = ;Data-access obj
; $z=1
;case $i=14
; $UDFthingy = ;Byte
; $z=1
case $i=15
$UDFthingy = "q",1,"a" ;Array
$z=1
Endselect

if $z=1
? ? "Test #" + $i
? "VarType=" + VarType($UDFthingy) + " " + VarTypeName($UDFthingy) ?
exit 2
endif
Endfunction

for $x=0 to 15
;$rc = UDFthingy($x)
UDFthingy($x)
if $z=1
?
if @error=0
color r+/n
"ERROR: "
color w/n
endif
"@@Error=@error"
endif
$z=0
next



[ 08 May 2002, 16:05: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/