From a1ca12a0a8c7932feeaade55c6fefc28394f7277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 8 Jul 2021 13:00:02 +0200 Subject: [PATCH] Clarify that non-byte array struct members are omitted by getters --- docs/contracts/visibility-and-getters.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/contracts/visibility-and-getters.rst b/docs/contracts/visibility-and-getters.rst index a865f54d4..f04945cfd 100644 --- a/docs/contracts/visibility-and-getters.rst +++ b/docs/contracts/visibility-and-getters.rst @@ -188,16 +188,24 @@ The next example is more complex: uint a; bytes3 b; mapping (uint => uint) map; + uint[3] c; + uint[] d; + bytes e; } mapping (uint => mapping(bool => Data[])) public data; } -It generates a function of the following form. The mapping in the struct is omitted -because there is no good way to provide the key for the mapping: +It generates a function of the following form. The mapping and arrays (with the +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 - 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; b = data[arg1][arg2][arg3].b; + e = data[arg1][arg2][arg3].e; }