WoW:API for

From AddOn Studio
Revision as of 15:05, 9 October 2005 by WoWWiki>D. F. Schmidt (ui-article)
Jump to navigation Jump to search

Template:UI-article

A "for" loop.

for <variable> = <lowvalue>, <highvalue> do <statements>; end

Executes 'statements' for each value of 'variable' from 'lowvalue' to 'highvalue', inclusive. Other syntax options yet unknown.


Example:

 /script for i=1,10 do DEFAULT_CHAT_FRAME:AddMessage(format("%d",i));end

More interesting example: (remember, all one line)

 /script for i=1,5 do
   name,description,standingID,barValue,atWarWith,canToggleAtWar,isHeader,isCollapsed=GetFactionInfo(i);
   DEFAULT_CHAT_FRAME:AddMessage(format("%s %d/%d,name,barValue*21000,21000));
 end