I have a mapping that is storing bytes32=>uint. I want to write a function that loops through this mapping and only returns a list of the uints.
I know you cannot have a dynamic array in the function as it has to be in memory. But I need to store them in an array to be able to return the array in the function.
I just want all the ints to be returned in an array so I can access it on my frontend via JS.
This is what I have so far (that doesn't work):
function getAllVotes () returns (uint[]) {
bytes32[] returnVotes;
for(uint i = 0; i < candidateList.length; i++) {
returnVotes[i] = bytes32(votesReceived[candidateList[i]]);
}
return returnVotes;
}