How to back track on a dictionary?

Imagine I have a dictionary like this,

local dictionary = {
["Category"] = {174114112, "Sample"},
{174114112, "Sample"},
{174114112, "Sample"}

I want the parent of that object on another script through an event,
The event brings you just the object so (player,Object) here Object is ‘{174114112, “Sample”}’.
I want to know Object.Parent.Name == "Category" how to make this happen?

I currently do it this way (not sure if it’s the best way):

local dictionary = {
[“SampleObject”] = {Name = “Sample”, ID = 179284, Category = “Anything”}

Basically I just put the category name in the object’s table.
If you’re looping through the table, you could also send the index of the table in the event.

1 Like

You should probably structure your dictionaries or system to be predictable in such a way that you don’t need backtracking because it’s not possible to do that without explicitly having that written in yourself.

It’s not a good example because the use cases are different but my framework (styled after AeroGameFramework) literally allows some systems to “backtrack” so that they can access parts of the code they conventionally would not be able to. Crude example of how it flows:

local Server = {}

Server.Client = {}
Server.Client.Server = Server

function Server:DoSomething()
    print("Server did something")

function Server.Client:DoSomething()
    return self.Server:DoSomething()


Not applicable for all cases though but since table references just point to the memory address and don’t readd the entire table elsewhere it’s certainly out there if you want.