about summary refs log tree commit diff stats
path: root/lua/allwords.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/allwords.lua')
-rw-r--r--lua/allwords.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/allwords.lua b/lua/allwords.lua new file mode 100644 index 0000000..b87f08a --- /dev/null +++ b/lua/allwords.lua
@@ -0,0 +1,17 @@
1function allwords ()
2 local line = io.read()
3 local pos = 1
4 return function ()
5 while line do
6 local s, e = string.find(line, "%w+", pos)
7 if s then
8 pos = e + 1
9 return string.sub(line, s, e)
10 else
11 line = io.read()
12 pos = 1
13 end
14 end
15 return nil
16 end
17end