I have this function.
How do I change only the parameters that aren't zero when calling the function? This is what I did
function changeParameters(uint newAnte, uint8 newNumberOfPlayers, uint newWinnerPart) {
if (msg.sender == owner) {
if (newAnte != 0) {
ante = newAnte;
}
if (newNumberOfPlayers != 0) {
required_number_players = newNumberOfPlayers;
}
if (newWinnerPart != 0) {
winner_part = newWinnerPart;
}
}
}
I'm certain there has to be a more efficient way
Thanks