Dictionary-Attempt to Index Field ? a Nil Value help
Hello WoW Interface,
I have been working on a simple AH analytics Addon and requires a bit of a bulky dictionary and have not worked with dictionaries outside of php (which has been a while). The way I am trying to lay out the dictionary is UrchinDictionary as the primary dictionary table with the key [1] holding a setting determining the number of snapshots of the AH to hold and [2]-[3]-[4] ect holding each snapshot. Because each snapshot can contain a lot of info on a single item due to multiple listings, it makes it a little more complicated. (reading the dictionary to me is the easy part) I have successfully pulled data from the AH and input listings into a table, but not completely having my head wrapped around a dictionary is giving me some complications. NOTE: some variables still have to be edited to become local variables I believe this is all the code neccessary to show: Code:
--UrchinDictionary is a saved variable that is working properly when adding records to a simple table And on top of my issue with the getting the dictionary to work, because a simple AH search can result in multiple listings, the code above is assuming there will only be one listing Any help is greatly appreciated! Thank you all in advanced :cool: |
I guess to simplyfy things I'm asking if someone could give an example of how to properly create a dictionary, or put arrays inside another array
|
Lua tables can be used as both indexed and associative arrays
(if that's what you mean with dictionaries) https://www.lua.org/pil/2.5.html -- Tables http://www.lua.org/pil/11.2.html -- Matrices and Multi-Dimensional Arrays Here are 2 examples of associative tables Lua Code:
Another 2 examples of a multidimensional array/table Lua Code:
Quote:
Looking at your code I would rewrite it like this (untested), but I honestly... can't understand what you're trying to do so there's probably a better way to do this :S Lua Code:
(edit) wait, why couldn't you just continue in your previous thread? :x http://www.wowinterface.com/forums/s...ad.php?t=54731 |
All times are GMT -6. The time now is 06:53 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI