use the new file API in most places

Really everywhere except zet.tlv. toot-toot is intended to emit
throwaway files anyway.
This commit is contained in:
Kartik K. Agaram 2022-03-06 02:48:04 -08:00
parent a8d0c1a56a
commit 8584e15b68
1 changed files with 6 additions and 4 deletions

View File

@ -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