Posted 06 May 2015 - 10:24 AM
Hi guys,
I am working on a vfs, and am having some troubles with tables.
What I am excpecting is that the tables tab and hi.there.how.are.you should be equal. However this is not the case. Why does this happen?
I am working on a vfs, and am having some troubles with tables.
Spoiler
--[[
VFS by Creator
]]--
--Variables
local filesystem = {}
--Functions
function makeTable(t,path)
path = fs.combine("",path)
print(path)
local first = path:match("[^/]+")
if first then
if t[first] then
return makeTable(t[first],path:sub(#first+2,-1))
else
t[first] = {}
return makeTable(t[first],path:sub(#first+2,-1))
end
else
print(t)
return t
end
end
tab = nil
hi = nil
tab = makeTable(_G,"hi////there/how/are/you")
hi.there.how.are.you = {[1] = true,[2] = "well"}
tab.youhou = "sdg"
print(hi.there.how.are.you)
print(tab)
print(textutils.serialize(hi.there.how.are.you))
print(textutils.serialize(tab))
What I am excpecting is that the tables tab and hi.there.how.are.you should be equal. However this is not the case. Why does this happen?