I was reading a tutorial on a medium about how to return an array of structs. This is the code they have for doing it.
pragma solidity ^0.4.13;
contract Project
{
struct Person {
address addr;
uint funds;
}
Person[] people;
function getPeople(uint[] indexes)
public
returns (address[], uint[])
{
address[] memory addrs = new address[](indexes.length);
uint[] memory funds = new uint[](indexes.length);
for (uint i = 0; i < indexes.length; i++) {
Person storage person = people[indexes[i]];
addrs[i] = person.addr;
funds[i] = person.funds;
}
return (addrs, funds);
}
}
The uint[] index
argument however makes no sense to me. Can someone please explain what it is and what it does?
uint[] indexes
argument? – valkn0t Jul 17 '18 at 13:54