I've followed the tutorial to set up save/load functionality in my game, but I'm finding that when I load the game any variables in the class which were defineda s integers are not loading. The reason seems to be because the data being passed in the load function is a string rather than integer.
To get around this, I can manually check the name of the variable and if I know it's an integer, then pass it as an integer, however this requires an if statement for every variable which is an integer. For example:
if i == "guests":
new_object.set(i, int(current_line[i]))
Is there a more efficient way to achieve this? How can the load function determine whether or not the saved value should be an integer and then set the variable accordingly?