about summary refs log tree commit diff stats
path: root/graphviz.tlv
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-18 20:55:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-03-18 20:55:07 -0700
commitc21cefa8881fbcdbff3206a223cbf58f0e07e5fd (patch)
tree66865869280a886a91e254bdaf8e5a030c27a65e /graphviz.tlv
parenta05f713dc11a543ea97c1160990552260618f629 (diff)
downloadteliva-c21cefa8881fbcdbff3206a223cbf58f0e07e5fd.tar.gz
idiom: table.insert for appending
Stop using arr[#arr+1].
Diffstat (limited to 'graphviz.tlv')
-rw-r--r--graphviz.tlv4
1 files changed, 2 insertions, 2 deletions
diff --git a/graphviz.tlv b/graphviz.tlv
index 941610e..9a5a776 100644
--- a/graphviz.tlv
+++ b/graphviz.tlv
@@ -237,7 +237,7 @@
     >-- concatenate list 'elems' into 'l', modifying 'l' in the process
     >function append(l, elems)
     >  for i=1,#elems do
-    >    l[#l+1] = elems[i]
+    >    table.insert(l, elems[i])
     >  end
     >end
 - __teliva_timestamp: original
@@ -814,7 +814,7 @@
     >  local result = {}
     >  for source, _ in pairs(Graph) do
     >    if not is_target[source] then
-    >      result[#result+1] = source
+    >      table.insert(result, source)
     >    end
     >  end
     >  return result