Get module: Asset Dictionary | A fast and easy way to get IDs
GetDictionary:
GetDictionary has 6 arguments. This function will loop through a specified target, get the ids of its children and appends them to the appropriate table. These can be accessed via
module.Dictionaries.(AssetType)Dictionary
These tables are:
- GeneralDictionary: contains every asset
- DecalDictionary: contains decals
- TextureDictionary: contains textures
- SoundDictionary: contains sounds
- MeshDictionary: contains meshes
- AnimationDictionary: contains animations
- VideoDictionary: contains videos
- ImageLabelDictionary: contains image labels
- ImageButtonDictionary: contains image buttons
- ShirtDictionary: contains shirts
- PantsDictionary: contains pants
- ParticleDictionary: contains particle emitters
Arguments:
Name | Information |
---|---|
Target | Obligatory, instance. Your asset container. |
Descendants | Optional, boolean, false. If this is true, the loop will run with GetDescendants instead of GetChildren. |
ClearTables | Optional, boolean, true. Not to be confused with ClearTable(), clears all tables before appending IDs, so you don’t have to run module:ClearAllTables(). |
DeleteTarget | Optional, boolean, false. If this is true, it will delete your Target. |
Sort | Optional, boolean, true. If this is false, the script won’t call table.sort() |
Reverse | Optional, boolean, true. This will not matter if Sort is set to false. This will sort the tables in reverse order. This is helpful if you used roblox’s bulk import. |
Optional, boolean, false. This will print all of the tables, a warning if it tries to scan an unsupported asset type and a benchmark. Note: the time starts as soon as the function is called and ends before the benchmark prints. |
Here is a code sample of the function’s usage:
local module = require(workspace.AssetDictionaryModule)
module:GetDictionary(workspace.Folder)
for index, key in pairs(module.DecalDictionary)
print(index, key)
end
module:ClearAllTables()
ClearTable:
This will clear a selected table. Due to the fact you can accidentally clear an unrelated table, this function only accepts strings with the table name with or without “Dictionary”
Arguments:
Name | Information |
---|---|
Table | Obligatory, string. Strings have to be either the asset type or the full table name. |
code sample:
module:ClearTable("Decal")
module:ClearTable("VideoDictionary")
ClearAllTables:
This function clears all tables. It has no arguments. Should be called after you finished using the tables.
code sample:
local assets = {}
module:GetDictionary(workspace.Folder)
for _, tables in pairs(module.Dictionaries) do
table.insert(assets, tables)
end
module:ClearAllTables()