2017-02-28 5 views
0

의 배열을 사용하여 :견고성 - 충전과 나는 다음과 같은 데이터 구조와 계약이 배열

struct Answer 
{ 
    bytes32 name; // short name (up to 32 bytes) 
    uint voteCount; // number of accumulated votes 
} 

struct Question 
{ 
    bytes32 name; // short name (up to 32 bytes); 
    Answer[] answers; 
} 

Question[] public questions; 

가 어떻게 배열을 채울 수 를?

다음 줄

은 작동하지 않습니다 :

function addQuestion(bytes32 _name, bytes32[] _answers) onlyOwner { // perhabs it should be possible that others as the owner can add 
    Answer[] memory answersLocal = new Answer[](_answers.length); 

    //Question memory question = Question(_name); 
    for (uint i = 0; i < _answers.length; i++) { 
    answersLocal[i] = Answer({ 
     name: _answers[i], 
     voteCount: 0 
     }); 
    } 

    questions.push(Question({ 
     name: _name, 
     answers: answersLocal 
     })); 

    } 

나는 여기에 오류 얻을 :

Copying of type struct Roadshow.Answer memory[] memory to storage not yet supported.

답변

0

이 같은 web3 또는 뭔가 브리지를 통해 계약에 액세스하려고합니다.

브릿지는 여전히 어레이 배열을 지원하지 않지만 견고성을 지원합니다!

오류가 견고하면 다른 유형의 오류가 표시됩니다.

희망이 도움이됩니다.