about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-12-07 17:29:00 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-12-07 17:29:00 -0800
commitde2152e313cc120728ca443146f36a85963a24df (patch)
treea621d766c5ffa77e836ed7d227dec0c0273c6080
parent20373578f46e076cf5af29b4cd37c4d7029c54fd (diff)
downloadteliva-de2152e313cc120728ca443146f36a85963a24df.tar.gz
new primitive: string split
-rw-r--r--advent.tlv13
1 files changed, 13 insertions, 0 deletions
diff --git a/advent.tlv b/advent.tlv
index a1652ac..afbff19 100644
--- a/advent.tlv
+++ b/advent.tlv
@@ -133,6 +133,19 @@ end
   {
     __teliva_timestamp = [==[
 original]==],
+    split = [==[
+function split(s, d)
+  result = {}
+  for match in (s..d):gmatch("(.-)"..d) do
+    table.insert(result, match);
+  end
+  return result
+end
+]==],
+  },
+  {
+    __teliva_timestamp = [==[
+original]==],
     window = [==[
 window = curses.stdscr()]==],
   },