I want to be able to edit values in a struct. My struct is declared and mapped like this :
struct entityLinks{
string linksUrl;
string linksName;
}
mapping (uint => entityLinks) allLinks;
The only matter is that i don't know how to dynamicly select the proper value in my struct. The only way I found was to pass a _targeted argument to manually select the proper property.
function editEntityLink(uint _entityLinks,uint _targeted,string _content) external onlyOwner() {
if(_targeted == 1){
allLinks[_entityLinks].linksName = _content;
}
else if(_targeted == 2){
allLinks[_entityLinks].linksUrl = _content;
}
}
I want to be able to have something which fit in 1 line without endless if ... (Trying to use a string as argument to edit the property don't work)
Thanks , I hope I was clear !