View Single Post
07/09/14, 06:13 PM   #8
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by zgrssd View Post
Because all those tables are "under the hood" are one List without allowed duplicates and one with allowed duplicates.
Absolutely not. Non-integer keys are hashed. Look at _G. If Lua were to go through the whole table everytime it needs to resolve a symbol, it would be unusable for almost anything, even simple scripts would take forever.
I'm not sure how tables with non-contiguous integer-only keys are implemented in Lua; I guess they're simply ordered binary-searched arrays.

Originally Posted by zgrssd View Post
Also I cannot guarantee that any value will be there only once. That is simply a matter of how the data looks and the patterns/exclusiong are set.
Better ending up with the same key twice in the array (easy to diagnose) then having sometimes the one key in use, sometimes the other (hard to diagnose).
That's why I proposed to make it sorted, and binary-searchable.
  Reply With Quote