mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11636 from ethereum/docs-clarify-struct-members-omitted-by-getters
[Docs] Clarify that non-byte array struct members are omitted by getters
This commit is contained in:
commit
c3fa520c75
@ -188,16 +188,24 @@ The next example is more complex:
|
|||||||
uint a;
|
uint a;
|
||||||
bytes3 b;
|
bytes3 b;
|
||||||
mapping (uint => uint) map;
|
mapping (uint => uint) map;
|
||||||
|
uint[3] c;
|
||||||
|
uint[] d;
|
||||||
|
bytes e;
|
||||||
}
|
}
|
||||||
mapping (uint => mapping(bool => Data[])) public data;
|
mapping (uint => mapping(bool => Data[])) public data;
|
||||||
}
|
}
|
||||||
|
|
||||||
It generates a function of the following form. The mapping in the struct is omitted
|
It generates a function of the following form. The mapping and arrays (with the
|
||||||
because there is no good way to provide the key for the mapping:
|
exception of byte arrays) in the struct are omitted because there is no good way
|
||||||
|
to select individual struct members or provide a key for the mapping:
|
||||||
|
|
||||||
.. code-block:: solidity
|
.. code-block:: solidity
|
||||||
|
|
||||||
function data(uint arg1, bool arg2, uint arg3) public returns (uint a, bytes3 b) {
|
function data(uint arg1, bool arg2, uint arg3)
|
||||||
|
public
|
||||||
|
returns (uint a, bytes3 b, bytes memory e)
|
||||||
|
{
|
||||||
a = data[arg1][arg2][arg3].a;
|
a = data[arg1][arg2][arg3].a;
|
||||||
b = data[arg1][arg2][arg3].b;
|
b = data[arg1][arg2][arg3].b;
|
||||||
|
e = data[arg1][arg2][arg3].e;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user