aboutsummaryrefslogtreecommitdiff
path: root/challenge-096/abigail/lua/ch-1.lua
blob: c2de0434f6fdb066bc57ce24dc940292c63aa46b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/opt/local/bin/lua

--
-- See ../README.md
--

--
-- Run as: lua ch-1.lua < input-file
--

for line in io . lines () do
    --
    -- Extract words and put them into an array, in reverse.
    --
    local words = {}
    for str in string . gmatch (line, "[^%s]+") do
        table . insert (words, 1, str)
    end

    --
    -- Print the words
    --
    io . write (table . concat (words, " "), "\n")
end