about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-02 08:36:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-02 08:37:04 -0700
commit3019442c02bd301dd9ce61f76c2a007aed202577 (patch)
tree87667d3a8154b97335705dbebbdf908bda58d3a8 /main.lua
parent4ad1cc4b543f668f1a62804ccff329b659878699 (diff)
downloadtext.love-3019442c02bd301dd9ce61f76c2a007aed202577.tar.gz
confirm that we have access to all of the love API
  love.graphics.line(1, 1, 500, 500)

However, we're now no longer printing results or errors. Time now to
design the data model. When do we (re)evaluate code. When do we display
results. Where do errors go.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index 272e72b..c3aa8f4 100644
--- a/main.lua
+++ b/main.lua
@@ -3,6 +3,7 @@ local utf8 = require 'utf8'
 
 lines = {}
 width, height, flags = 0, 0, nil
+exec_payload = nil
 
 function love.load()
   table.insert(lines, '')
@@ -24,6 +25,10 @@ function love.draw()
   end
   -- cursor
   love.graphics.print('_', 12+text:getWidth(), #lines*15)
+
+  if exec_payload then
+    call_gather(exec_payload)
+  end
 end
 
 function love.update(dt)
@@ -47,8 +52,9 @@ function keychord_pressed(chord)
       end
     end
   elseif chord == 'C-r' then
-    lines[#lines+1] = eval(lines[#lines])[1]
-    lines[#lines+1] = ''
+    eval(lines[#lines])
+--?     lines[#lines+1] = eval(lines[#lines])[1]
+--?     lines[#lines+1] = ''
   end
 end
 
@@ -64,11 +70,15 @@ end
 function eval(buf)
   local f = load('return '..buf, 'REPL')
   if f then
-    return call_gather(f)
+    exec_payload = f
+    return
+--?     return call_gather(f)
   end
   local f, err = load(buf, 'REPL')
   if f then
-    return call_gather(f)
+    exec_payload = f
+    return
+--?     return call_gather(f)
   else
     return {err}
   end