Stresse 2 Posted October 10, 2019 Share Posted October 10, 2019 Howdy y'all! I'm working on a little plugin to help me recruit to get that 8th Guild Bank slot (because, you know, I'm a bit spoiled ?). I pulled the following from a pure Lua project I had been working on to do this recruitment (more) manually. Problem is, there are a shit ton of queries (and not a predictable number) and I can't think of a sane way of doing it individually. Feels like there must be a way to take the table and turn it into a Dictionary<int,string> (or just get rid of the damn indexes and turn it into a list of strings)...but I can't figure out how. Can anyone help? -- Everything here is Horde-specific; the plugin will have both local ClassyRaceAchievementIDs= {5163,5165,5160,6625,5161,5162,5164} local Races = {"Blood Elf","Goblin","Orc","Pandaren","Tauren","Troll","Undead"} local Classes = {"Death Knight","Demon Hunter","Druid","Hunter","Mage","Monk", "Paladin","Priest","Rogue","Shaman","Warlock","Warrior"} local RaceAchievementIDs= {[5163]="Blood Elf", [5165]="Goblin", [5160]="Orc", [6625]="Pandaren", [5161]="Tauren", [5162]="Troll", [5164]="Undead"} local queries={} for i=1,#ClassyRaceAchievementIDs do local id = ClassyRaceAchievementIDs[i] local numCriteria= GetAchievementNumCriteria(id) local raceStr= RaceAchievementIDs[id] for c=1,numCriteria do local criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible = GetAchievementCriteriaInfo(id,c) local classStr if tContains(Classes,criteriaString) then for i=1,#Classes do if Classes[i] == criteriaString then classStr=Classes[i] end end end local query="r-\""..raceStr.."\" c-\""..classStr.."\" 120" if completed==false then tinsert(queries, query) end end end return queries Link to comment https://wrobot.eu/forums/topic/11658-how-to-handle-returning-a-full-lua-table/ Share on other sites More sharing options...
Droidz 2742 Posted October 11, 2019 Share Posted October 11, 2019 hi, No tested, bu like that: var result = new Dictionary<int, string>(); var r = Lua.LuaDoString<List<string>>(@" local ClassyRaceAchievementIDs= {5163,5165,5160,6625,5161,5162,5164} local Races = {""Blood Elf"",""Goblin"",""Orc"",""Pandaren"",""Tauren"",""Troll"",""Undead""} local Classes = {""Death Knight"",""DemonHunter"",""Druid"",""Hunter"",""Mage"",""Monk"",""Paladin"",""Priest"",""Rogue"",""Shaman"",""Warlock"",""Warrior""} local RaceAchievementIDs= {[5163]=""Blood Elf"", [5165]=""Goblin"", [5160]=""Orc"", [6625]=""Pandaren"", [5161]=""Tauren"", [5162]=""Troll"", [5164]=""Undead""} local queries={} for i=1,#ClassyRaceAchievementIDs do local id = ClassyRaceAchievementIDs[i] local numCriteria= GetAchievementNumCriteria(id) local raceStr= RaceAchievementIDs[id] for c=1,numCriteria do local criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible = GetAchievementCriteriaInfo(id,c) local classStrif tContains(Classes,criteriaString) then for i= 1,#Classes do if Classes[i] == criteriaStringthen classStr=Classes[i] end end end local query=""r-\""""..raceStr..""\"" c-\""""..classStr..""\"" 120"" if completed==false then tinsert(queries, id) tinsert(queries, query) end end end return unpack(queries) "); if (r.Count % 2 == 0) { for (int i = 0; i < r.Count; i += 2) { int q; if (robotManager.Helpful.Others.ParseInt(r[i], out q)) result.Add(q, r[i+1]); } } Stresse 1 Link to comment https://wrobot.eu/forums/topic/11658-how-to-handle-returning-a-full-lua-table/#findComment-55970 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now