Here I create a table to collect what template exist.
local revised = {}
for i, v in next, self.Content do
if v ~= nil then
print(1, i, v, typeof(i), typeof(v)) -- 1 Shovel Template string Instance
revised[i] = {
ok = false,
template = v
}
end
end
Here I check if it still has to exist.
for _, v in next, data.own_items.tools[1] do
print(2, v, typeof(v)) -- 2 Shovel string
if v ~= nil then
if revised[v] ~= nil then
revised.ok = true
end
end
end
Here I want delete the template and the connections but the loop return me the variable "ok" and the value of it "true" or "false". Why?
for i, v in next, revised do
print(3, i, v, typeof(i), typeof(v)) -- 3 ok true string boolean ?
if not v.ok then
v.template:Destroy()
for _, c in next, self.Connections[i] do
c:Disconnect()
end
end
end
