alestane icon

Dictionary loader (pre-yield)

alestane | PRO | 01/17/14 03:41:00 PM UTC | 0 ⭐ | 319 👁️ | Never ⏰ | []
Lua |

330 B

|

None

|

0 👍

/

0 👎

local path = system.pathForFile("wordlist.txt",system.ResourceDirectory)
 
local function dictionary(path)
    local dictTable = {}
    coroutine.yield(dictTable)
    for line in io.lines(path) do
        dictTable[line] = true
        print(tostring(line))
    end
    return dictTable
end
 
local loader = coroutine.wrap(dictionary)
 
return loader(path)

Comments