Returning the correct type

Blitz3D Forums/Blitz3D Programming/Returning the correct type

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I was just wondering if there is better\ faster way to return a custom type then using a for loop.

for instance, if you have 100 player types with individual names and ids, but you wanted to find a player named Joe so you could smack him with a rubber duck, is the below code the only way to pick him out of a group of 100 players?


For P.player = Each player
	If P\name = "Joe" Then
		Smack_With_Rubber_Duck("Joe")
		Exit
	EndIf
Next


Thanks for any help here.

EDITED: Fixed the player name call, thanks KED