diff options
author | Case Duckworth | 2015-03-06 22:08:20 -0700 |
---|---|---|
committer | Case Duckworth | 2015-03-06 22:08:20 -0700 |
commit | e01ed83975933e4c8eafcda7950db98342ddfd63 (patch) | |
tree | 0739c8cea3fb07b5ee48870ed096b093e33e8c3b /lua/allwords.lua | |
parent | Change compile.sh to also compile RIVER files (diff) | |
download | autocento-e01ed83975933e4c8eafcda7950db98342ddfd63.tar.gz autocento-e01ed83975933e4c8eafcda7950db98342ddfd63.zip |
Switch to compile.lua for reasons
Diffstat (limited to 'lua/allwords.lua')
-rw-r--r-- | lua/allwords.lua | 17 |
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 @@ | |||
1 | function 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 | ||
17 | end | ||