-- std/io/io.cat -- input/output helpers (standard library module). -- -- Thin, catscript-level conveniences over the C-provided natives. -- Use: use "std/io/io.cat" -- Print each argument on its own line. function print_lines(a) local i = 1 while i <= len(a) do print(a[i]) i = i + 1 end end -- Join a list's items with a separator, returning one string. function join(a, sep) local out = "" local i = 1 while i <= len(a) do if i > 1 then out = out .. sep end out = out .. tostring(a[i]) i = i + 1 end return out end -- Read a whole file as text ("" when missing). function read_text(path) local s = read_file(path) if s == empty then return "" end return s end -- Write text to a file, returning bytes written. function write_text(path, text) return write_file(path, text) end