local function ImportFile(filename) local contents = glon.decode(file.Read(filename)) or {} local output = {} local buffer = {} for k, v in pairs(contents) do buffer[#buffer + 1] = { ent = v.ent, pos = v.pos } table.Add(output, buffer) end return outputend
Thinking something like this. No need to use 2 loops and 2 string.Explodes. If it's gonna end up being a table save it as a table using glon.
Never really ever used glon. Good idea.
local function ImportFile(filename)
local contents = glon.decode(file.Read(filename)) or {}
local output = {}
local buffer = {}
for k, v in pairs(contents) do
buffer = { ent = v.ent, pos = v.pos }
table.Add(output, buffer)
buffer = {}
end
return output
end