Values of table changing after added to another table

local tableofspecificationnames = {
	["Description"] = "",
	["OS"] = "",
	["RAM"] = "16GB",
	["DisplaySize"] = "",
	["DisplayClarity"] = "8K",
	["Warranty"] = "1Y",
	["Processor"] = "SpeedCPU"
}

local currenttableoflaptopscatalog = {}
local currenttableoflaptopprocatalog = {}

local function getneworder(description,idofdevice)
	local idforram = rng:NextInteger(1,7)
	tableofspecificationnames["RAM"] = tableofram[idforram]
	tableofspecificationnames["Processor"] = tableofprocessor[rng:NextInteger(1,#tableofprocessor)]
	tableofspecificationnames["DisplaySize"] = tableofdisplaysize[rng:NextInteger(1,#tableofdisplaysize)]
	tableofspecificationnames["DisplayClarity"] = tableofdisplayclarity[rng:NextInteger(1,#tableofdisplayclarity)]
	tableofspecificationnames["OS"] = tableofos[rng:NextInteger(1,#tableofos)]
	tableofspecificationnames["Warranty"] = tableofwarranty[rng:NextInteger(1,#tableofwarranty)]
	tableofspecificationnames["Description"] = description
	print(tableofspecificationnames)
	if idofdevice == 1 then
		table.insert(currenttableoflaptopscatalog,tableofspecificationnames)
	elseif idofdevice == 2 then
		table.insert(currenttableoflaptopproscatalog,tableofspecificationnames)
	end
	print(currenttableoflaptopscatalog)
end

getneworder("Laptop for Personal",1)

And this is individual print result

["Description"] = "wBook - PRO",
["DisplayClarity"] = "1440P",
["DisplaySize"] = "Big",
["OS"] = "Laptop Regular OS",
["Processor"] = "SpeedCPU",
["RAM"] = "32GB",
["Warranty"] = "2Y"

But when u add these into a table
and print the table at last
This is the result

                  [1] =  ▼  {
                       ["Description"] = "Laptop - PRO",
                       ["DisplayClarity"] = "4K",
                       ["DisplaySize"] = "Small",
                       ["OS"] = "Regular OS",
                       ["Processor"] = "PRO CPU",
                       ["RAM"] = "16GB",
                       ["Warranty"] = "3Y"
                    },
                    [2] =  ▼  {
                       ["Description"] = "Laptop - PRO",
                       ["DisplayClarity"] = "4K",
                       ["DisplaySize"] = "Small",
                       ["OS"] = "Regular OS",
                       ["Processor"] = "PRO CPU",
                       ["RAM"] = "16GB",
                       ["Warranty"] = "3Y"
                    } - Server

Its adding same value tables into the table, and its not adding the table which was printed, and seems to be added

ChatGPT solved this, thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.