View Single Post
05/30/14, 01:38 AM   #7
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 655
Originally Posted by Wobin View Post
Just as a note, you can escape early from that loop by using return true as soon as you have a match and return false outside the loop.
Lua Code:
  1. function Harvest.IsValidWoodworkingName(name)
  2.     for lang, langs in pairs(Harvest.langs) do
  3.         for k, v in pairs(Harvest.woodworking[langs]) do
  4.             if v == name then
  5.                 return true
  6.             end
  7.         end
  8.     end
  9.  
  10.     return false
  11. end
Like that you mean?
  Reply With Quote