From 8584e15b68c145c3c7a4511b917d9f6b3d20294c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 6 Mar 2022 02:48:04 -0800 Subject: [PATCH] use the new file API in most places Really everywhere except zet.tlv. toot-toot is intended to emit throwaway files anyway. --- life.tlv | 10 ++++++---- 1 file 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