How to read .ini with values owning fields

Hello everyone,

I am implementing a code where I’m trying to read data from a custom.ini as the following:
[/scripts/commands]
command=(type=“Skill”,name=“BasicAttack”,label=“Basic Attack”,description=“Execute a basic attack”,skill=“TestSkill”)

Unfortunatelly, I’ve not found any way to parse the value other than FString… I can implement a logic to parse that data in a TMap, but I’m guessing if there is any built-in implementation we can use in that case.

Thanks

Hi.

Check how [/Script/Cascade.CascadeConfiguration] from BaseEditor.ini is made. I think You just have to make a struct:

USTRUCT()
struct FCommand
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY()
	FString type;

	UPROPERTY()
	FString name;

	// ... etc.
};

then you need a field in your class:

UPROPERTY(config)
FCommand command;

Your class is:

UCLASS(config=Game)
class UCommands : public UObject

To learn how structs in config files are parse, I think you need to check how it works in GConfig under the hood…