Created
October 1, 2018 07:50
-
-
Save aquiladev/75ac4f981075caa059ccfdd71125899b to your computer and use it in GitHub Desktop.
CText.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.23; | |
contract CText { | |
struct TextThatDoesNotWork { | |
bytes32 text; | |
uint reads; | |
address addr; | |
} | |
TextThatDoesNotWork[] textArray; | |
function put(bytes32 _text, uint _reads) public { | |
textArray.push(TextThatDoesNotWork({ | |
text: _text, | |
reads: _reads, | |
addr: msg.sender | |
})); | |
} | |
function listTexts() public view returns (bytes32[], uint[], address[]) { | |
bytes32[] memory texts = new bytes32[](textArray.length); | |
uint[] memory readsArray = new uint[](textArray.length); | |
address[] memory addresses = new address[](textArray.length); | |
for (uint i = 0; i < textArray.length; i++){ | |
texts[i] = textArray[i].text; | |
readsArray[i] = textArray[i].reads; | |
addresses[i] = textArray[i].addr; | |
} | |
return (texts, readsArray, addresses); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment