I have a problem with return variables. I am looking at a function that can return a array or it can return an error code. I am trying to encapsulate all this into a select Case statement. Here is the code I am working with. Code:
  

Any Ideas?
Function HomeMachine($HomeINIFile, $User, $WkStation)
$HomeMachine = -1
$delimiter = "!"
$wsDelimiter = ","
$workstations = GetINI($HomeIniFile,$User, $delimiter)
Select
Case Ubound($workstations) <> 0
For Each $Line in $workstations
$ndx = IofSubStr($Line,$delimiter,1)
If $ndx = 0
MessageBox("Substring (" + $delimiter + ") not found in " + $Line ,"substring not found")
EndIf
$ndx = IofSubStr($Line,$delimiter,$ndx+1)
If $ndx = 0
MessageBox("Substring (" + $delimiter + ") not found in " + $Line ,"substring not found")
EndIf
;MessageBox("line is " + $line + " | ndx is " + $ndx + " | Len is " + Len($Line),"info")
$strUsersWorkstations = Right($Line,Len($Line)-$ndx)
$ret = MessageBox($strUsersWorkstations,"Users Workstations")
$Workstations = Split($strUsersWorkstations,$wsDelimiter)
For Each $lpWkstation in $workstations
If $Wkstation = $lpWkstation
$HomeMachine = 1;
EndIf
Next
Next
Case ($workstations = 2)
$HomeMachine = 2
Case ($workstations = 13)
$HomeMachine = 13
EndFunction

Function GetINI($File,optional $Section, optional $d)
DIM $Rootdata, $sec, $i, $ii, $secdata, $Error
DIM $Tarray[0]
If not $d $d = "," EndIf
If not Exist($file) $GetINI = 2 Exit EndIf
$Rootdata = Split(ReadProfileString($file,$section,""),CHR(10))
If UBound($rootdata) = 0 $GetINI = 13 Exit EndIf
ReDIM preserve $rootdata[ubound($rootdata)-1]
If not $section
$i = 0
For Each $sec In $rootdata
$secData = GetINI($file,$sec,$d)
$error = @ERROR
ReDIM preserve $tarray[UBound($tarray)+UBound($secdata)+1]
For $ii = 0 To UBound($secdata)
$tarray[$i] = $secdata[$ii]
$i = $i + 1
Next
Next
If UBound($tarray) > 0 ReDIM preserve $tarray[$i-1] EndIf
Else
ReDIM preserve $tarray[ubound($rootdata)]
For $i = 0 To UBound($rootdata)
$tarray[$i]=$section+$d+$Rootdata[$i]+$d+ReadProfileString($file,$section,$Rootdata[$i])
Next
EndIf
$GetINI = $tarray
Exit($error)
EndFunction



Any Ideas?