I want to create a Pokémon structure with an array of structs inside.
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract PokemonFactory {
struct Pokemon {
uint256 id;
string name;
Ability[] abilities;
}
struct Ability {
string name;
string description;
}
Pokemon[] public pokemons;
function createPokemon(string memory _name, string memory _abilityNme, string memory _abilityDscription) public {
uint id = pokemons.length;
pokemons[id].abilities.push(Ability(_abilityNme, _abilityDscription));
pokemons.push(Pokemon(id, _name, pokemons[id].abilities));
}
}
But I am getting the following error:
UnimplementedFeatureError: Copying of type struct PokemonFactory.Ability memory[] memory to storage not yet supported.