The order of saved variables
Working on my first addon so am quite new a this.
I am using AceBd to set up my database and that seems to work ok. But my problem is the order of the of fields in my tables as you can see in the example. Anybody know how I can solve this? Lua Code:
|
Lua-tables dont know an order and they dont keep one. If you want to make sure to have an order you'd have to sort them the time you access them or you'd use numbered indexes.
For the later you have ipairs to iterate over http://www.lua.org/pil/7.3.html |
Based on what you posted, I assume you will be accessing values like this:
MyAddon.db.char.data_char_entering ...in which case there is no need for any order. As Rilgamon said, the Lua programming language has no concept of an order for the key/value pairs in a table. The order in which they are written out in the saved variables file is essentially random, and has no effect on anything. |
If you want to read them sorted your could use spairs:
Lua Code:
|
Thanks for the help.
Based on the information you people have given I will continue :) |
All times are GMT -6. The time now is 04:04 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI