Getting the number of indexes in an array.
View Single Post
01-23-14, 05:43 PM
A Flamescale Wyrmkin
Join Date: Aug 2009
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.
View Public Profile
Send a private message to Aanson
Find More Posts by Aanson