Originally Posted by Garkin
Or you can replace table.insert and remove whole DoesScriptNameExist function:
|
I was originally doing something similar to what you suggested adding the information to the table and checking to see if it already existed like this:
Lua Code:
if not CLICK4INFO.sv.scripts[scriptName] then
CLICK4INFO.sv.scripts[scriptName] = script
end
By the way doing it like this does NOT cause the error.
But if I do it like that then every time I try to populate the scroll list with that information I would have to copy it into another table & reorganize it like this any way:
Lua Code:
{["scriptName"] = scriptName, ["script"] = script}
Because in When you call:
Lua Code:
local entry = ZO_ScrollList_CreateDataEntry(ROW_TYPE_ID, rowData, 1)
table.insert(dataList, entry)
To add a row to the scrollList you have to pass in rowData which is a table
(well it doesn't have to be a table, but since I need to pass in two pieces of information it needs to be a table to hold all of the information). If I did it the old way:
Lua Code:
CLICK4INFO.sv.scripts[scriptName] = script
I would loose the scriptName & only script would get passed to my setupDataRow function. Unless I copy the script information into the correct format first so I can pass in rowData as a table like:
Lua Code:
{["scriptName"] = scriptName, ["script"] = script}
Although I could do that..it just seemed like a waste and slower. My choices are do a little extra function call with special code to see if a scriptName already exists,
which only runs when you add a new script. Or Repack all of the information into a new table
every time the data is displayed.
The only thing that stops the error
(without changing it to the old way that Garkin suggested) is commenting out this line:
Lua Code:
--table.insert(CLICK4INFO.sv.scripts, {["scriptName"] = scriptName, ["script"] = script})
So the problem has to have something to do with that?