Let's say I have a custom datatype "mapping (bytes32 => address) public users"; Now I would like to write a function which returns the users object.
I tried "function getAddress(bytes32 name) returns (users user) {
return users;
}" no luck. "Type error: Invalid type name". Any help is greatly appreciated.
0 ·
Comments
If you're trying to access the users variable from within solidity, use
users[name]
to get the address of the user named name, orusers[name] = someaddress
to assign someaddress to the user named name.If you're trying to access the users variable from JavaScript, use:
contractName.users(name)
where contractName is the name of your contract. As long as users is public, this just works. Unfortunately, there's no automatic way to assign from javascript.