Is there a way to get length of an array in an other contract without a getter?
pragma solidity ^0.4.11;
contract MyContractA {
uint[] public myArray;
function MyContractA() {
myArray.length = 1;
}
}
contract MyContractB {
function test() returns (uint ret) {
address instanceAddress = new MyContractA();
MyContractA instance = MyContractA(instanceAddress);
// works:
return instance.myArray(0);
//
// doesn't work:
//
// TypeError: Member "length" not found or not visible after argument-dependent lookup in function (uint256) constant external returns (uint256)
// return instance.myArray.length;
// TypeError: Member "length" not found or not visible after argument-dependent lookup in function (uint256) constant external returns (uint256)
// return instance.myArray.length();
// TypeError: Wrong argument count for function call: 0 arguments given but expected 1.
//return instance.myArray().length;
}
}