about summary refs log tree commit diff stats
path: root/life.tlv
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-06 02:48:04 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-03-06 02:49:26 -0800
commit8584e15b68c145c3c7a4511b917d9f6b3d20294c (patch)
tree690c843c5e4a35e10a011f588255b1fc00a98243 /life.tlv
parenta8d0c1a56a82684ec0db7b4fa622b3b34e50fffd (diff)
downloadteliva-8584e15b68c145c3c7a4511b917d9f6b3d20294c.tar.gz
use the new file API in most places
Really everywhere except zet.tlv. toot-toot is intended to emit
throwaway files anyway.
Diffstat (limited to 'life.tlv')
-rw-r--r--life.tlv10
1 files changed, 6 insertions, 4 deletions
diff --git a/life.tlv b/life.tlv
index 78cfa9f..7567697 100644
--- a/life.tlv
+++ b/life.tlv
@@ -526,11 +526,13 @@
     >end
 - __teliva_timestamp: original
   load_file:
-    >function load_file(window, filename)
-    >  local infile = io.open(filename, 'r')
+    >function load_file(window, fs, filename)
+    >  local infile = start_reading(fs, filename)
     >  if infile == nil then return end
     >  local line_index = lines  -- quarter of the way down in pixels
-    >  for line in infile:lines() do
+    >  while true do
+    >    local line = infile:recv()
+    >    if line == nil then break end
     >    if line:sub(1,1) ~= '!' then  -- comment; plaintext files can't have whitespace before comments
     >      local col_index = cols
     >      for c in line:gmatch(".") do
@@ -649,7 +651,7 @@
     >    --
     >    -- For example, check out the list of Important Patterns at
     >    -- https://www.conwaylife.com/wiki/Category:Patterns_with_Catagolue_frequency_class_0
-    >    load_file(Window, arg[1])
+    >    load_file(Window, nil, arg[1])
     >  end
     >
     >  -- main loop