I have run into an issue that I am unsure how to get around.
I have a subroutine that shows the user a list of player numbers and names, and its supposed to return the player number of the player the user selects. But, it doesnt work. its complaining about unable to return a value on a resumable sub. Seems like a huge limitation. Any ideas?
Here is the code:
The code hasn't been debugged yet because I cant get past the limitation ATM, So I don't know if it even works.
I have a subroutine that shows the user a list of player numbers and names, and its supposed to return the player number of the player the user selects. But, it doesnt work. its complaining about unable to return a value on a resumable sub. Seems like a huge limitation. Any ideas?
Here is the code:
The code hasn't been debugged yet because I cant get past the limitation ATM, So I don't know if it even works.
B4X:
Sub ShowPlayerList(side As String) As Int
Dim I As Int
Dim A As Int
Dim Index() As Int
Dim PlayerList As List
Dim Players() As String
PlayerList.Initialize
A = 0
For I = 0 To 14 Step 1
If side = "home" Then
If PlayerOnCourtHome(I) > 0 Then
Index(A) = I
Players(A) = PlayerNumberHome(I) & " - " & PlayerNameHome(I)
A = A + 1
End If
Else
If PlayerOnCourtGuest(I) > 0 Then
Index(A) = I
Players(A) = PlayerNumberGuest(I) & " - " & PlayerNameGuest(I)
A = A + 1
End If
End If
Next
If Players.Length = 0 Then Return 999 'No On-Court Players were found.
PlayerList.AddAll(Players)
InputListAsync(PlayerList, "Select a Player", -1, False)
Wait For InputList_Result (Ret As Int)
If Ret <> DialogResponse.CANCEL Then
If side = "home" Then
I = PlayerNumberHome(Index(Ret))
Return I
Else
I = PlayerNumberGuest(Index(Ret))
End If
Else
Return 888 'User didn't select a player, or canceled.
End If
End Sub