export TMap<FString, FString> to ZScript as Dictionary

Moderator: GZDoom Developers

Post Reply
User avatar
m8f
 
 
Posts: 1461
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Location: Siberia (UTC+7)
Contact:

export TMap<FString, FString> to ZScript as Dictionary

Post by m8f »

Simple string-to-string map (dictionary) allows to store and retrieve key-value string pairs.

Extra feature: get serialized dictionary as a string, so the user can store it in a CVar. So this Dictionary can be used between games.

There are several mods in need of this data structure (Weapon Menu, Lazy Points, Target Spy). Maybe FragTrak could use it too.

PR: https://github.com/coelckers/gzdoom/pull/999

PS. It's no way I got everything right in unfamiliar code, so I'm ready to fix any issues.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: export TMap<FString, FString> to ZScript as Dictionary

Post by Player701 »

I could really use a generic Dictionary<TKey, TValue> like in .NET. Too bad ZScript does not have generic types...

However, this particular one will probably come in handy as well. Thank you.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: export TMap<FString, FString> to ZScript as Dictionary

Post by Graf Zahl »

I am not a fan of such generic containers. At work I have to deal with a project which used these for all data storage. The result: It's impossible to track content because no error triggers the compiler's syntax check, it's all dictionaries with a wild mixture of object types in them. Refactoring that stuff to something robust is a nightmare and I very much prefer not to see that in GZDoom ever.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”