Quantcast
WoWInterface - View Single Post - Help with ipairs
View Single Post
07-25-17, 10:16 AM   #3
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 453
For indexed arrays (like in your case) prefer using the numeric for-loop (you can use the # table operator as the limit here). Use ipairs if you have deeply nested arrays or if it makes the code more readable (the second part of this sentence is hardly an argument as you can use local values or upvalues here). Use either "next, t" or "pairs(t)" for associative arrays only (MunkDev's last example should have used either numeric for or ipairs instead of pairs for efficiency reasons)
  Reply With Quote