Advertisement
alestane

letterCounter

Jan 17th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.26 KB | None | 0 0
  1. local function countLetter(word, letter)
  2.     return (select(2, word:gsub(letter, letter)))
  3. end
  4.  
  5. local function countLetterInDictionary(dict, letter)
  6.     local total = 0
  7.     for _, word in pairs(dict) do
  8.         total = total + countletter(word, letter)
  9.     end
  10.     return total
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement