Edit of asset "Text Database" Accepted
Old/Current | New/Edit | |
---|---|---|
Title | Text Database | |
Description |
Advanced loader for text data files (JSON, CFG). It can load your files and perform a complex data validation. If you like keeping your data in text files, this will be useful as it ensures that your data is correct, i.e. without typos. Data collections in TextDatabase are arrays of dictionaries. You can e.g. store items, enemy data, or level metadata etc. in a JSON or CFG files, where each item/enemy/level/etc is a Dictionary with some properties. You can define fields for your data, which can be either mandatory, or just allowed, and the loader will ensure that your fields are correct. Example usage: var database = TextDatabase.new() database.add_mandatory_property("price") database.add_valid_property("attack") database.load_from_path("res://items.json) var data = database.get_array() Example valid file: [ { "name": "Sword", "price": 100, "attack": 5 } ] Example invalid file: [ { "name": "Shield", "defense": 1 } ] It's missing "price" and "defense" is not a defined property, so the file won't load. You can catch errors like this, so you can avoid unexpected behaviors due to data typos. btw, ConfigFiles (CFG) are much better than JSON. Here's the Sword example as CFG: [Sword] price = 100 attack = 5 You can store multiple items in one file and load multiple files into database. Just use load() multiple times on one database and then get_array() will return data from all files. Or you can use get_dictionary() instead and access the entries by name. Explaining all functionality would be very long, so just read the README, which you can find in the asset's repository (: You can also find an example project in there. |
|
Category | Scripts | |
License | MIT | |
Repository Provider | GitHub | |
Repository Url | https://github.com/KoBeWi/Godot-Text-Database | |
Issues Url | https://github.com/KoBeWi/Godot-Text-Database/issues | |
Godot version | Godot 4.0 | |
Version String | 1.3 | 1.2 |
Download Commit | 1e5a034016774e494f79c1ad3ead63e91b0f280c | e30cbfd023b1d098ee3b38650afd6246599ab687 |
Download Url (Computed) | https://github.com/KoBeWi/Godot-Text-Database/archive/1e5a034016774e494f79c1ad3ead63e91b0f280c.zip | https://github.com/KoBeWi/Godot-Text-Database/archive/e30cbfd023b1d098ee3b38650afd6246599ab687.zip |
Icon Url |
https://raw.githubusercontent.com/KoBeWi/Godot-Text-Database/master/Media/Icon.png
|