You could also get around that by giving CreateDataEntry a wrapper table instead of copying the data:
Lua Code:
local entry = ZO_ScrollList_CreateDataEntry(typeId, {mydata = realdata})
-- it will then look like this
entry = {
typeId = typeId,
categoryId = categoryId,
data = {mydata = realdata, dataEntry = entry},
}
-- the data.dataEntry.data.dataEntry... cycle doesn't infect realdata
Or use a metatable:
Lua Code:
local mtdata = {__index = realdata}
local entry = ZO_ScrollList_CreateDataEntry(typeId, setmetatable({}, mtdata))
mtdata.__newindex = realdata
-- it will then look like this
entry = {
typeId = typeId,
categoryId = categoryId,
data = {dataEntry = entry},
}
-- but entry.data.thing will return realdata.thing