View Single Post
03-29-18, 08:47 PM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
k, v are the values being iterated through in your for loop (k = key, v = value)

You use those variables in the loop and it "increments" through to the next key/value every time it loops through.

Example usage:

lua Code:
  1. local function contains(table, element)
  2.     for _, value in pairs(table) do
  3.         if value == element then
  4.             return true
  5.         end
  6.     end
  7.     return false
  8. end

Last edited by Ammako : 03-29-18 at 08:49 PM.
  Reply With Quote