Quantcast WoWInterface - View Single Post - Beta API discussion
View Single Post
08-06-12, 07:33 PM   #202
Farmbuyer
A Cyclonian
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 43
Originally Posted by Allara View Post
It wouldn't surprise me if units were stored as a bitmask or some other representation (not a string) at the C level, which is why this isn't working as you'd expect. It'd also be much faster than a string comparison, which is why this new function is very helpful.
Lua string comparisons are O(1); in fact, inside the scripting engine, they are a simple pointer comparison, as equal string values are guaranteed to be at the same place in the string pool.

That said, I agree they're likely doing something special with unit IDs, and wouldn't expect this function to work on random strings (although my armchair guess is that, given the way string "interning" works, it wouldn't be Too Difficult to make it work...).