if you didnt understand, my apology i probably made this unclear, but anyways
i want with a script to do this
(i made an image to show how its like)
“Name” being the parent
and then the “Things” are the children of that parent so when i access it with a script it becomes like this
Name.Thing
so how can i make this using a script?
quakage
(quakage)
November 27, 2023, 7:20pm
#2
Not sure exactly if this is what you want but I’ve added another item so you see how to modify it as well. One thing to be careful of is also using a variable like Name. All Roblox objects have a property called Name which has priority so I typically make my key and object names like PlayerName or something longer.
local Name = {
["Thing"] = "Thing",
["Thing2"] = "Thing",
["Thing3"] = "Thing",
}
Name["Thing4"] = "NewThing"
print(Name)
print(Name.Thing)
you could do
local Table = {
[“Name”] = {
[“Thing”] = {Object = (path)}}
}
or if u mean to add to a table Table.insert(table, value)
1Keeth
(Keeth)
November 27, 2023, 8:08pm
#4
I was facing a similar issue earlier today and this is how I overcame the problem:
Table["Name"]["DescendantName"] = "Value"
This can add a descendant to the table or set the value of a descendant that is currently in the table.
1 Like
appreciated very much, for some reason there was no answer anywhere.
2112Jay
(2112Jay)
November 27, 2023, 8:15pm
#6
local grandparentTable = {
name = "Grandparent",
age = 60,
hobbies = {"Reading", "Gardening"}
}
local parentTable = setmetatable({
name = "Parent",
job = "Engineer",
children = 2
}, {__index = grandparentTable})
local childTable = setmetatable({
name = "Child",
grade = 10,
hobbies = {"Sports", "Drawing"}
}, {__index = parentTable})
local grandchildTable = setmetatable({
name = "Grandchild",
grade = 5,
hobbies = {"Video Games", "Cycling"}
}, {__index = childTable})
print(grandchildTable.name) -- Output: Grandchild
print(grandchildTable.age) -- Output: 60
print(grandchildTable.job) -- Output: Engineer
print(grandchildTable.hobbies[1]) -- Output: Video Games
1 Like
2112Jay
(2112Jay)
November 27, 2023, 8:16pm
#7
A bit hard core but why not learn deep.
1 Like
system
(system)
Closed
December 11, 2023, 8:18pm
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.