alestane

Dictionary loader (resume)

Jan 17th, 2014
281
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, trigger)
  4.     local dictTable = {}
  5.     coroutine.yield(dictTable)
  6.     for line in io.lines(path) do
  7.         dictTable[line] = true
  8.         print(tostring(line))
  9.     end
  10.     timer.cancel(trigger)
  11. end
  12.  
  13. local loader = coroutine.wrap(dictionary)
  14.  
  15. return loader(path, timer.performWithDelay(1, loader, 0))
Advertisement
Add Comment
Please, Sign In to add comment