summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-12-27 20:07:36 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2017-12-27 20:11:19 +0100
commit3b2282c96234f6f8c82d86f124d43c949b44688d (patch)
tree75fe8fb849788907f5fa9fd0c186bdd0a0a150c9 /data
parente19526846fb42e78e162343d1c959ad74a8e077e (diff)
data/sample.lua: use `next` instead of for loop
Each definition list item contains just a single key and the associated value. Using `next` to get the key/value pair is more idiomatic than iterating over the single-element table.
Diffstat (limited to 'data')
-rw-r--r--data/sample.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/data/sample.lua b/data/sample.lua
index dd90af29d..6c09442b5 100644
--- a/data/sample.lua
+++ b/data/sample.lua
@@ -245,10 +245,9 @@ end
function DefinitionList(items)
local buffer = {}
for _,item in pairs(items) do
- for k, v in pairs(item) do
- table.insert(buffer,"<dt>" .. k .. "</dt>\n<dd>" ..
- table.concat(v,"</dd>\n<dd>") .. "</dd>")
- end
+ local k, v = next(item)
+ table.insert(buffer, "<dt>" .. k .. "</dt>\n<dd>" ..
+ table.concat(v, "</dd>\n<dd>") .. "</dd>")
end
return "<dl>\n" .. table.concat(buffer, "\n") .. "\n</dl>"
end