I have the following pair of methods in my game file handler:
func saveHand(deal, state, pressStack, dealNum):
var file = File.new()
var fileName = savePath + "/deal" + str(dealNum) + "-"
fileName += dateTimeStamp() + ".txt"
file.open(fileName, File.WRITE)
file.store_csv_line(deal)
file.store_csv_line(state)
file.store_csv_line(pressStack)
file.close()
var dealPsa
var statePsa
var stackPsa
func retrieveHand(fileName):
var file = File.new()
file.open(fileName, File.READ)
dealPsa = file.get_csv_line() # Get deal psa
statePsa = file.get_csv_line() # Get deal psa
stackPsa = file.get_csv_line() # Get deal psa
The first three arguments to save hand are poolStringArrays and result in the following file:
9C,AS,6H,9H,6D,10S,8C,2C,9S,3H,4S,10C,3S,2D,AD,7H,5H,QS,3D,KC,JS,8D,4H,10H,KD,2H,QH,QD,5S,AH,JD,6C,4C,KS,10D,7C,JC,QC,9D,7S,5D,2S,KH,4D,JH,7D,3C,5C,8S,6S,8H,AC
1500,20,10,True,False,False,False,False,Sean,,2,0,0,1,True,False,False,False,False,True,True,Michael,1500,1500,0,False,2,True,False,False,False,False,True,True,Cullam,1500,1500,0,False,3,True,True,False,False,True,True,True,Sean,1500,1500,0,False,4,True,False,False,False,False,True,True,Glenn,1500,1500,0,False,5,True,False,False,False,False,True,True,Clyde,1500,1500,0,False,3,4
Deal,Sean,True,0,see,Michael,False,0,raise,Cullam,False,80,fold,Sean,False,0,see,Glenn,False,0,see,Clyde,False,0,see,Michael,False,0,Flop,Sean,True,0,check,Glenn,False,0,check,Clyde,False,0,raise,Michael,False,100,see,Cullam,False,0,fold,Glenn,False,0,fold,Clyde,False,0,Turn,Sean,True,0,check,Michael,False,0,check,Cullam,False,0,River,Sean,True,0,check,Michael,False,0,check,Cullam,False,0,Value,Sean,True,0
which, as expected is in the form of thee sets of comma separated values separated by newlines.
However, when retrieveHand(fileName) attempts to read them back dealPsa, statePsa and stackPsa are just three empty poolString arrays. Since the function is called getcsvline() shouldn't it fill the PoolStringArrays with the CSV's in the three lines?
fileName is the name of the file from which the data has been taken, cut and pasted from windows explorer. No errors are thrown. If I print the three variables I just get:
[]
[]
[]
enter code here