4
library Lib{
    struct Data {
        mapping (uint => uint) a;
    }

    function inc(Data self) internal{
        self.a[0] =+1;
    }
}
contract Example{

    address recipient = 0x0000cafebabe;

    Lib.Data data;

    function send(){
        Lib.inc(data);
    }
}

Leads to error

7:9: Error: Member "a" is not available in struct Data memory outside of storage.
        self.a[0] =+1;
        ^----^
5

Have your code changed as below

function inc(Data storage self) internal{
        self.a[0]=+1;
    }

Note the storage part of it. Please understand the concepts of Internal Types for variables and In memory types

  • 1
    wow didn't know, need to check this Monday, must go to the F1 race with my father this tomorrow – Roland Kofler Jul 2 '16 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.