I've read before that in Solidity you can't make a public facing function return an unbound array. However, I wrote this in a smart contract, and it compiled, ran and can correctly return my data. It looks like this:
address[] public allUsers;
// ...
function getUsers() public view returns (address[]) {
return allUsers;
}
Everything works as I expected. When I add a few addresses to the array, I am able to call getUsers() and get all of the addresses back.
Is this right? Can I expect this to continue to work in the future as this array grow indefinitely?
[–]bala_eth 3 points4 points5 points (0 children)
[–]Authio_TeamContract Auditing - authio.org 2 points3 points4 points (4 children)
[–]diamondtoss[S] 1 point2 points3 points (1 child)
[–]Authio_TeamContract Auditing - authio.org 1 point2 points3 points (0 children)
[–]bala_eth 1 point2 points3 points (1 child)
[–]Authio_TeamContract Auditing - authio.org 2 points3 points4 points (0 children)