this did work, it and seems alot simplier than whatever those other scripts i looked at were doing.
just one more thing though?
if i had a entry somewhat like this
local EntryTable = {
["Entry1"] = "CoolText",
["Entry2"] = "NotSoCoolText",
["Entry3"] = {["FirstEntry"] = "BoringEntry", ["SecondEntry"] = "SuperCoolText"}
}
im just guessing but would it be something like this to turn it into a string?
for Key, Value in pairs(EntryTable) do
if typeof(Value) ~= "table" then
String..=`{Key}:{Value} | `
elseif typeof(Value) == "table" then
String..=`{Key}:(`
for Key2, Value2 in pairs(Value) do
String..=`{Key2}:{Value2} | `
end
String..=") | "
end
end
if this is how then ill just need a bit of time to figure out how to revert it back to dictionary format
(edit)
used typeof instead of value == table
(edit2)
did some of my own research and got this code now
local EntryTable = {
["Entry1"] = "CoolText",
["Entry2"] = "NotS oCoolText",
["Entry3"] = {["FirstEntry"] = "BoringEntry", ["SecondEntry"] = "SuperCoolText"}
}
local String = ""
for Key, Value in pairs(EntryTable) do
if typeof(Value) ~= "table" then
String..=`{Key}:{Value} | `
elseif typeof(Value) == "table" then
String..=`{Key}:(`
for Key2, Value2 in pairs(Value) do
String..=`{Key2}:{Value2} | `
end
String..=") | "
end
end
print(String)
local Values = {}
local Pattern = "(%w+:%b())"
local Pattern2 = "(%w+:(%w+)[%w%s]+)"
for Key, Value in string.gmatch(String, Pattern) do
if Key then
table.insert(Values, Key)
local split = string.split(String, Key)
String = ""
for i, v in pairs(split) do
String..=v
end
end
end
for Key, Value in string.gmatch(String, Pattern2) do
if Key then
table.insert(Values, Key)
end
end
i know get to the result of this
(if i print the
Value
table)
i just need to figure out how to split the first entry without spliting it at the other points aswell.