about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-05-30 00:32:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-05-30 00:32:14 -0700
commite3eecdd506c208bf61b04c6ea5bbcdd4894b08e5 (patch)
tree657c0ee2a32397b17a2ff64093d828ad3da58c1c
parent7ef5f1e0bbca4b0500acdaf32b83a16babf9c450 (diff)
parent074f4d9b0a51dc99df9183a45a9c2301f575b35b (diff)
downloadview.love-e3eecdd506c208bf61b04c6ea5bbcdd4894b08e5.tar.gz
Merge text.love
-rw-r--r--app.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/app.lua b/app.lua
index b41b1ad..1d4a72b 100644
--- a/app.lua
+++ b/app.lua
@@ -316,16 +316,26 @@ end
 -- fake files
 function App.open_for_writing(filename)
   App.filesystem[filename] = ''
-  return {
-    write = function(self, ...)
-              local args = {...}
-              for i,s in ipairs(args) do
+  if Current_app == nil or Current_app == 'run' then
+    return {
+      write = function(self, ...)
+                local args = {...}
+                for i,s in ipairs(args) do
+                  App.filesystem[filename] = App.filesystem[filename]..s
+                end
+              end,
+      close = function(self)
+              end,
+    }
+  elseif Current_app == 'source' then
+    return {
+      write = function(self, s)
                 App.filesystem[filename] = App.filesystem[filename]..s
-              end
-            end,
-    close = function(self)
-            end,
-  }
+              end,
+      close = function(self)
+              end,
+    }
+  end
 end
 
 function App.open_for_reading(filename)