Hello!
Recently, I’ve been having some troubles implementing a “BackTrack” feature that allows you to go back to a table’s parent. For example, say we define a table such as Table1 = { Table2 = {} }
The main question is: "If you ONLY had Table2, How would you get Table1?" So far, I’ve made a ModuleScript that will temporarily work. The reason it’s temporary is that I can’t turn a directory into a string. Doing so will return a hexadecimal code of the actual table that is in the directory. Here is the first iteration of my work:
local module = {}
function module.BackTrack(str, original)
local split = str:split('.')
print(split)
local last = split[#split]
assert(#split-1 ~= 0, 'backtrack cant be used on single tables')
local before = #split-1
local current = original
warn(before)
for i = 2, before do
current = current[split[i]]
end
return current
end
return module
Thank you for looking at my post, And I hope you can help me, reader!
