Passing lists from a function

BlitzMax Forums/BlitzMax Beginners Area/Passing lists from a function

bstripp(Posted 2005) [#1]
I want to pass a result list from a function. My code looks something like this:

method whichpos()
local a%
local templist:TList
		
for a = 1 to maxplayers%
	templist = lookupplayerval("PID",PID%[a])
        <<Snipped code here>>
Next
	
End Method

function lookupplayerval(fld$,val%)
local tp:player
local templist:TList
	
for tp:player = eachin Plist
     select fld$
	case "TID"
		if val% = tp.TID% then
			templist.AddLast tp
		end if
        <<Snipped other redundant cases here>>
	end select
Next
	
return templist
	
End Function


When I try to build this code, it is saying that I am trying to assign an integer to a list. How would I pass the resultant list?


Dreamora(Posted 2005) [#2]
function lookupplayerval:TLIST (fld$,val%)


You have to add the return type to the function declaration


bstripp(Posted 2005) [#3]
Thanks!