Thread: I hate lua.
View Single Post
11-05-05, 11:36 AM   #10
Trimble Epic
An Aku'mai Servant
 
Trimble Epic's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 31
the common notation 'for k,v in table do' is used because it's easy to read/recognize.

Whenever you use the 'generic' form of the for statement on a table WITHOUT an iterator (i.e. 'for k,v in table' vs. for 'k,v in pairs(table)' ), the for statement automatically provides 2 variables for each run through the loop - the key and it's associated value - thus k and v. When we (teachers?) give helpful examples, we commonly use k,v to emphisize the key and the value inside the sample.

yes, 'for k,v...' works on every table.
  Reply With Quote