From 6066e69b45e77124b98e50bcebb6c36ce6db45d1 Mon Sep 17 00:00:00 2001 From: Tangent Date: Wed, 26 Aug 2026 19:50:49 -0600 Subject: [PATCH] only open the file WHEN you need to --- convert_transcript.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/convert_transcript.lua b/convert_transcript.lua index cb3d67d..5cc1792 100755 --- a/convert_transcript.lua +++ b/convert_transcript.lua @@ -13,9 +13,6 @@ local link = io.read("*line") local title = input_file_name:sub(1, -5) -- assumes .txt extension local output_file_name = title .. ".md" -local output_file = io.open(output_file_name, "w") -assert(output_file, "Could not open \"" .. output_file_name .. "\"") - local frontmatter = { "---", "title: \"" .. title .. "\"", @@ -29,6 +26,9 @@ if link and #link > 0 then frontmatter[#frontmatter + 1] = "From [" .. link .. "](" .. link .. ")\n" end +local output_file = io.open(output_file_name, "w") +assert(output_file, "Could not open \"" .. output_file_name .. "\"") + for _, line in ipairs(frontmatter) do output_file:write(line) output_file:write("\n")