[Added] export TMap<FString, FString> to ZScript as Dictionary

Moderator: GZDoom Developers

export TMap<FString, FString> to ZScript as Dictionary

Postby m8f » Sun Dec 29, 2019 4:43 am

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
m8f
dreamer
 
 
 
Joined: 29 Dec 2017
Location: Siberia (UTC+7)
Discord: m8f#0629
Github ID: mmaulwurff
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit

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

Postby Player701 » Sun Dec 29, 2019 11:33 am

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
Player701
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

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

Postby Graf Zahl » Sun Dec 29, 2019 12:19 pm

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests