Thread Tools Display Modes
03-29-10, 02:07 PM   #1
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
element update order

I can't decide if I can rely on Health always updating before Power when traversing __elements. In oUF.lua elements is a hash table, both update functions are injected using a simple tinsert without the index argument, thus their order should be undefined. Yet for some reason Health's index always seems to be lower. Did I miss something or is it just a coincidence I should not rely on?
  Reply With Quote
03-29-10, 05:22 PM   #2
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
In fact I just discovered __elements is no longer iterated with ipairs but with next, and according to the Lua Reference Manual "the order in which the indices are enumerated is not specified, even for numeric indices". Even though I ran a couple of tests and the array values of tables persistently come up in ascending order. Haste himself uses this in oUF_lily:

table.insert(self.__elements, 2, PostCastStop)

Which again makes no sense for an undefined iteration. Does WoW redefine the next function to behave differently? Something is fishy here.
  Reply With Quote
03-31-10, 03:27 AM   #3
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
The code you posted from Lily is just leftovers from the old system. The update order is undefined however, so I wouldn't rely on any of it's behavior.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » element update order


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off