about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-15 14:38:11 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-15 14:38:11 -0700
commit6b6098593e2682d1a8f6095bc87ad91872f18cb7 (patch)
treecf69ffe3c193b7c4b5b66582b3177083a4766142
parentf98712c0058ad1b3e3d5e5e744fade94eca2b725 (diff)
downloadlines.love-6b6098593e2682d1a8f6095bc87ad91872f18cb7.tar.gz
delete an ancient, unused file
-rw-r--r--mu.lua75
1 files changed, 0 insertions, 75 deletions
diff --git a/mu.lua b/mu.lua
deleted file mode 100644
index be56705..0000000
--- a/mu.lua
+++ /dev/null
@@ -1,75 +0,0 @@
-curses = require 'curses'
-
-local stdscr = curses.initscr()
-curses.echo(false) -- unclear why implicit echo can't handle newlines, regardless of stdscr:nl()
-stdscr:clear()
-stdscr:scrollok(true)
-
-local function readline()
-  local result = ''
-  while true do
-    local x = stdscr:getch()
-    stdscr:addch(x)
-    local c = string.char(x)
-    result = result .. c
-    if c == '\n' then break end
-  end
-  return result
-end
-
--- based on https://github.com/hoelzro/lua-repl
-function eval_print(f)
-  local success, results = gather_results(xpcall(f, function(...) return debug.traceback() end))
-  if success then
-    for i, result in ipairs(results) do
-      if i > 1 then
-        stdscr:addch('\t')
-      end
-      stdscr:addstr(tostring(result))
-    end
-  else
-    stdscr:addstr(tostring(result[1]))
-  end
-  stdscr:addch('\n')
-end
-
-local function gather_results(success, ...)
-  local n = select('#', ...)
-  return success, { n = n, ... }
-end
-
-local new_expr = true
-local buf = ''
-while true do
-  if new_expr then
-    stdscr:addstr('> ')
-  else
-    stdscr:addstr('>> ')
-  end
-  buf = buf .. readline()
-  -- print value of expression the way Lua 5.3 does it: by prepending 'return' to the line
-  local f = load('return '..buf, 'REPL')
-  if f then
-    buf = ''
-    new_expr = true
-    eval_print(f)
-  else
-    local f, err = load(buf, 'REPL')
-    if f then
-      buf = ''
-      new_expr = true
-      eval_print(f)
-    else
-      if string.match(err, "'<eof>'$") or string.match(err, "<eof>$") then
-        buf = buf .. '\n'
-        new_expr = false
-      else
-        stdscr:addstr(err..'\n')
-        buf = ''
-        new_expr = true
-      end
-    end
-  end
-end
-
-curses.endwin()