11-02-18, 07:02 PM | #1 |
Need a second set of eyes to spot the error
I am getting an "unexpected symbol near 'local'" error, and for the life of me, I can't see the thing. Is the word "list" a bad name for a variable in Lua and I missed the memo?
Full error: Lua Code:
And lines 1-30 of my code: Lua Code:
|
|
11-02-18, 08:01 PM | #2 |
AddOnList.list ={}
list = AddOnList.list I don't think you can make a local table inside of a table with the syntax you've used. |
|
11-02-18, 08:54 PM | #3 |
Assuming you wans list as a table in AddOnList otherwise, remove the AddOnList references.
Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 11-02-18 at 08:59 PM. |
|
11-02-18, 10:25 PM | #4 |
Ah ha. Here's my entire code. I'll load into game shortly to test. After line adjustments, I am trying to populate line 186 with the values contained in AddOnList. I don't need a table inside a table. I'm not sure if the do/end loop is necessary; I just put it there in case.
Lua Code:
|
|
11-03-18, 12:30 AM | #5 |
I don't Ace so I don't know what format AddOnList is supposed to be in, I was going on the sort you were using which was on the key "name".
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
11-03-18, 07:38 AM | #6 |
You have to move the "local AddOnList = {}" outside the do...end block or the rest of your code won't be able to see it.
Code:
local AddOnList = {} do for i = 1, GetNumAddOns() do local folderName, title = GetAddOnInfo(i) if not exempt[folderName] then table.insert(AddOnList, {name = title}) end end table.sort(AddOnList, function(a, b) -- sort alphabetically return a.name > b.name end) end |
|
11-03-18, 10:20 AM | #7 | |
Code:
values = k, v I am looking at GatherMate2's returned table, which needs to be a lot more complex than what I am doing, largely because GM2's table has zone, expansion, and gathered item data. It is also a metatable, which might be useful in case data is added or removed (maybe, in my case, if the user toggled AddOns on/off). For reference, in GM's options table, it has values = sortedFilter["Archaeology"] or values = sortedFilter["Treasure"] etc. My addon is not a plugin for GatherMate; I am merely looking at its code for reference on how to populate a table (values) with a set of unknown quantities (I have no idea which addons the user has installed, or how many). Below is code from GatherMate2. It is the return from values = blah in the options table. Lua Code:
|
||
11-03-18, 10:43 AM | #8 |
I see the confusion. GatherMate2 is using setmetatable() but you tried to put a block of code directly into a table.
GatherMate2: local sortedFilter = setmetatable( object, metaTable ) You: local AddOnList = { --[[ block of code ]] }
__________________
|
|
11-03-18, 11:44 AM | #9 |
I think I solved it with your hints, tips, and extra eyes. I'll trim out the extra code, so the line numbers won't line up, but it gets the point. I will know for sure next time I log in. The adjusted line 195 now reads
Code:
values = function() return SortedAddOns(AddOnList) end, Lua Code:
Last edited by myrroddin : 11-03-18 at 11:56 AM. Reason: syntax update for values = |
|
WoWInterface » Developer Discussions » Lua/XML Help » Need a second set of eyes to spot the error |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|