I've been extending the CC Destructable_Manager to add additional information into the spawned object (such as the team that created them)
Im hitting what I assume is a noobie Lua error when I try to pass "componentList" table from the Destructable_Manager script to my own Construction_Manager script
This is the function i added into the Destructable_Manager (it prints what I expect without error)
function PrintAllObjects()
for component, table in pairs(componentList) do
print(component, table.team, table.name)
end
print(componentList)
return componentList
end
This is the function in my own Construction_Manager script that tries to get the componentList data from function above...
function Tick()
Task.Wait(2)
print("tick")
destructableMgr = require(propDestructionServer)
local componenList = destructableMgr.PrintAllObjects()
print(componenList)
for component, table in pairs(componentList) do
print(component, table.team, table.name)
end
end
Note, the print(componentList) outputs the same reference in both functions.
However, in the second function the for loop fails with the following error
"bad argument #1 to 'for iterator' (table expected, got nil)"
Which doesn't make any sense to me(!)