I am sure this is a basic question but I can’t seem to get this right…
I want to copy data into an existing table that hasn’t got that sub-key. In this example I though this was as easy as if I just added the .name key to friendsWithApp[k]
But I get the error attempt to index field ‘?’ (a string value)
--given this two tables
local friends ={1,32 }
local dataCopy ={{name="hello"},{name="world"} }
--create a new one and copy the content
local friendsWithApp={}
friendsWithApp = friends
--try to add the .name key and assign the value
for k, v in pairs (friendsWithApp) do
friendsWithApp[k].name = dataCopy[1].name -- end
Thanks for the help, I don’t know if this is possible or would like to know about alternative ideas [import]uid: 74667 topic_id: 30337 reply_id: 330337[/import]