From aeaa7d150cacb5f858f1b516ca3e2234c68b8e55 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 23 Aug 2022 15:04:30 -0700 Subject: helper: file_exists --- file.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'file.lua') diff --git a/file.lua b/file.lua index 9440ae8..6b36b0f 100644 --- a/file.lua +++ b/file.lua @@ -1,4 +1,14 @@ -- primitives for saving to file and loading from file +function file_exists(filename) + local infile = App.open_for_reading(filename) + if infile then + infile:close() + return true + else + return false + end +end + function load_from_disk(State) local infile = App.open_for_reading(State.filename) State.lines = load_from_file(infile) -- cgit 1.4.1-2-gfad0 ='this.form.submit();'> Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log tree commit diff stats
path: root/linux/print-file.mu
blob: 6dded6ba03bd57130e4f2024e64561088966a50c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39