View Single Post
05/30/14, 01:07 AM   #6
Wobin
 
Wobin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 78
Originally Posted by Sharlikran View Post
I am going to try this Lua console from source forge, no idea how to use it yet though. ^_^

Does anyone know a good Lua console that is easy to run like Python and Ruby?

Lua Code:
  1. function Harvest.IsValidWoodworkingName(name)
  2.     local nameMatch = false
  3.     for lang, langs in pairs(Harvest.langs) do
  4.         for k, v in pairs(Harvest.woodworking[langs]) do
  5.             if v == name then
  6.                 nameMatch = true
  7.             end
  8.         end
  9.     end
  10.  
  11.     return nameMatch
  12. end

That all works fine, so I have to build off of it and try to apply it to what I want with the map names.
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.
  Reply With Quote