Advertisement
alestane

Dictionary loader (coroutine)

Jan 17th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local path = system.pathForFile("wordlist.txt",system.ResourceDirectory)
  2.  
  3. local function dictionary(path)
  4.     local dictTable = {}
  5.     for line in io.lines(path) do
  6.         dictTable[line] = true
  7.         print(tostring(line))
  8.     end
  9.     return dictTable
  10. end
  11.  
  12. local loader = coroutine.wrap(dictionary)
  13.  
  14. return loader(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement