Dict+ l A module for all your dictionary needs!

Hi so, I just wanted to test out my skills with this module and it was cool making my own module this took about 3 days to make but the main features are listed on this website. The repo on git hub can be found here

The main focus of this module is to reduce the amount of code needed for searching within dictionaries and common dictionary features. This will also work for deep dicts. This module also comes with .changed which acts like a RBXScriptSignal more details can be found on the website.

WARNING THIS ONLY WORKS ON DICTIONARIES
If you use this with an array it will error so be careful.

This is all open source i don’t mind sharing the code any suggestions, errors and features you would like to see can be asked under this or open up an issue on GitHub and I will get on it.

P.S: I know some things like .find can be done easily but this can be handy when dealing with large dicts.

5 Likes

Some of the functions are fine, like getn, but a lot of these functions are one-liners:

module.find(x, y)
x[y]

module.remove(x, y)
x[y] = nil

module.encode(x)
httpService:JSONEncode(x)

module.decode(x)
httpService:JSONDecode(x)

What benefit does this module have over these built-in alternatives? (Also, having it on Github as an .rbxlx or .lua allows for easier PR submission since the code is more directly viewable.)

11 Likes

Well i just thought that i would make it open sourced of course you could use the regular ways but this is much simpler for people who are just getting started yet it offers functions that are extended for more power users.

Why is it in a pcall?

A lot of this is unnecessary wrapping and complication for no reason.

image

This test fails if dict[find] is false, and there is trailing tabs for some reason.

image

I am not sure what this is meant to return, it returning the error message if any just seems so arbitrary as it is unlikely.

So how exactly is this any simpler or otherwise better than just directly indexing? :slight_smile:

Update! I have updated the module; no more pcalling you may test the module here:

Dict Plus.rbxm (5.3 KB)

The only two functions are getn and changed as i realized that other functions didn’t have much use, i will update the git hub page soon!
Instead of pcalling i know use assert to check if the given argument is proper, I have also fixed the cases of when getn did return -1 of the amount of keys that you had.

Also sorry for the one month fix, i had lots of school work to do

Not to be rude, but this is made pretty poorly and I don’t understand the purpose of this module. There’s more to this than what @sjr04 pointed out about the pcall.

image

Why are you iterating to see if a key exists? Not only that, but in your for loop you check if find is in the dictionary every iteration. Basically, you just made dictionary lookups inefficient. If the key doesn’t happen to exist, no matter what it will look through every key.