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:
|
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. |
Assuming you wans list as a table in AddOnList otherwise, remove the AddOnList references.
Lua Code:
|
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:
|
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".
|
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 = {} |
Quote:
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:
|
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 ]] } |
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:
|
All times are GMT -6. The time now is 07:26 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI