The purpose I want to use the metatables for is dynamic map generation, I’m creating parts, and assigning parts (generations). If it is still confusing, I am trying to create a Data Structure or Data “Tree” of values. If you are familiar with linked list or binary trees, it is similar to that.
The parts are only connected to one or two other data(s) (With the exception of the first Generation of parts.).
What I am doing currently is saving those parts to a table;
local structs = {part1, part2, part3, etc...} -- Structures
then setting the “Generation” of those parts as they are created.
local structs = {part1, part2, part3, etc...} -- Structures
local structsmt = {"GenerationA", "GenerationB", "GenerationC", etc...}
setmetatable(structs, structsmt)
After the generation is saved, the parts will only be allowed to flow in certain directions. I want to grasp the generation name from a metatable, and if the generation name meets the requirements, proceed to establish a connection.
This is a copy of what I have told @starmaq who has given a lovely community tutorial on how metatables work. He explained to me that metatables might not be the way to go for my purpose. If metatables aren’t the right way, what is?
This topic seems to have a promising answer, but I would like some clairification on how it works and how I can turn it into something for me to use.
Keep in mind I’m trying to keep the lines of code as minimal as possible.
Anything Helps!