Last active
August 29, 2015 14:15
-
-
Save Adidea/d985a6abede037f51072 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function module.Load(data) | |
--convert string to table | |
print(data) | |
local newData = http:JSONDecode(data) --convert json string to table | |
local function traverseTable(tab) --traverse table and hunt for C3(n,n,n) strings to convert to color3 | |
for i,v in pairs(tab) do | |
if type(v) == "table" then | |
traverseTable(v) | |
elseif type(v) == "string" and v:match("^C3%(.+,.+,.+%)") then | |
--is a color3 | |
local r,g,b = v:match("%((.+),(.+),(.+)%)") | |
tab[i] = Color3.new(r,g,b) --commenting out this line (or even using a different table prevents crash) | |
--could be the script requiring valid data crashing, but I don't see how. This snippet is the easiest to rip apart. | |
end | |
end | |
end | |
traverseTable(newData) | |
--print("save me: ", db.DisplayTable(newData)) | |
return newData | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment