Quantcast WoWInterface - View Single Post - Getting the number of indexes in an array.
View Single Post
01-23-14, 05:43 PM   #5
Aanson
A Flamescale Wyrmkin
Join Date: Aug 2009
Posts: 124
Using "#" to get the number of indices of an array was not limited to varargs. It could be used for any array. It just so happens that a vararg expression is an array.

In the example provided, the event list will change depending on several factors which means that I'm unable to just register 3 events. I would do just that, if that wasn't the case.

I think it to be good practice to avoid using pairs/ipairs wherever possible. Especially when the function isn't just called once during set-up.

Anyone know the better of these two? getn(self.Events) vs #self.Events? I expect it's probably negligible to the point of being irrelevant.

Thanks for your input.
__________________
__________________
  Reply With Quote