Works:
Code:
function PLD.ScrollList(list)
ZO_ScrollList_Clear(MainFrameListFrameList)
local datalist = ZO_ScrollList_GetDataList(MainFrameListFrameList)
local known
local nametable
local listsize = PLD.TableSize(nametable, list)
for i = 1, listsize do
local level = nametable[i].Level
local saved = PLDGetTierSavedVar(i, list, 0)
if IsItemLinkRecipeKnown(nametable[i].Link) == false then
if saved == 1 then
known = "|cffffff[s] |r"
elseif saved == 0 then
known = "|cc3c3c3[ ] |r"
end
else
known = "|cffff00[*] |r"
end
datalist[i] = ZO_ScrollList_CreateDataEntry( 1,
{
RecipeName = known .. "|c3a92ff" .. nametable[i].Name .. "|r" .. "|cffffff " .. level .. "|r",
}
)
end
ZO_ScrollList_Commit(MainFrameListFrameList, datalist)
end
Doesn't work:
Code:
function PLD.Test()
ZO_ScrollList_Clear(MainFrameListFrameList)
local datalist = ZO_ScrollList_GetDataList(MainFrameListFrameList)
local known
local searchtext = MainFrameSelectionFrameSearchBox:GetText():gsub('%W',''):lower()
for i = 1, 486 do
local name = ProvisioningLabels[i].Name:gsub('%W',''):lower()
if (string.find(name,searchtext) ~= nil) then
local ln = tonumber(ProvisioningLabels[i].Position)
local level = ProvisioningLabels[ln].Level
local saved = PLDGetTierSavedVar(i, 15, ln)
if IsItemLinkRecipeKnown(ProvisioningLinks[ln].Link) == false then
if saved == 1 then
known = "|cffffff[s] |r"
elseif saved == 0 then
known = "|cc3c3c3[ ] |r"
end
else
known = "|cffff00[*] |r"
end
datalist[i] = ZO_ScrollList_CreateDataEntry( 1,
{
RecipeName = known .. "|c3a92ff" .. ProvisioningLabels[ln].Name .. "|r" .. "|cffffff " .. level .. "|r",
}
)
end
end
ZO_ScrollList_Commit(MainFrameListFrameList, datalist)
end
No errors, just fails to populate the list. Debug text shows all values are correct.
INFURIATING.