summary refs log tree commit diff stats
path: root/lua/allwords.lua
blob: b87f08a8f946013313ade84c1aba8e95eeaa2a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function allwords ()
    local line = io.read()
    local pos = 1
    return function ()
        while line do
            local s, e = string.find(line, "%w+", pos)
            if s then
                pos = e + 1
                return string.sub(line, s, e)
            else
                line = io.read()
                pos = 1
            end
        end
        return nil
    end
end