Basically I have a table that should store some other table, this is the code:

local function getTable(object)
	return { name = object.name, age = object.age}
end

local function createTable(source)

	local table= {}
	for i, object in ipairs(source:GetChildren()) do
		
		local data = getTable(object)
		
		table["A" .. tostring(i)] = data
		
		print("name of the data: " .. table["A" .. tostring(i)].name) --first output
	end
	
	for i, data in ipairs(table) do
		print("data: " .. tostring(i) .. " name:" .. data.name) --second output
	end
	
	return table
end

local table = createTable(source)
print(table) --third output

The first output print the name of the data storage, but the second output never print, because there is no data in the table, and the third output just print nil, I still don't know where is the error, how this should be implement in lua.

So, does someone know who to store tables inside a table?

Any help would be appreciated

2 comments

0

Can you give us the getTable function?

0

done