Timeline for Accessing a mapping within a struct via Truffle console
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 31, 2017 at 21:36 | comment | added | atc | Gotcha point taken. I'm just trying to work within the context of the Solidity docs. | |
Aug 31, 2017 at 3:51 | comment | added | Rob Hitchens | The thing is you can't. This is why I suggest dropping the mapping that you can't access and using an array that you can access. For clarity (I hope), you could build a function that returns one mapped value at a time, but you would have to supply the key to the mapping to know which "one" to return. That means you'll need to keep a list somewhere. The whole idea of the code sketch above is to keep a list instead of using a data structure that won't do what you want. | |
Aug 31, 2017 at 3:02 | comment | added | atc | @RobHitchens I'm still confused as to how to access the mapping within a struct given the code posted in my question. Edmund suggested building your own accessor function. | |
Aug 31, 2017 at 2:58 | comment | added | Rob Hitchens | Point taken. I've added a very compressed that is hopefully coherent. | |
Aug 31, 2017 at 2:58 | history | edited | Rob Hitchens | CC BY-SA 3.0 |
Added summarized explanation.
|
Aug 31, 2017 at 2:24 | comment | added | Ismael♦ | An answer like this is not very helpful if the links dissapear it will end without content. It is better if you put here the main idea and the links works as a complement. | |
Aug 31, 2017 at 0:06 | history | answered | Rob Hitchens | CC BY-SA 3.0 |