Dictionary loader (pre-yield)
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