about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-05 16:19:51 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-11-05 16:25:45 -0700
commit216e56effc28677b0a237b5b0ae834b15aca6f1e (patch)
treea26e9d5e1995e9507687c39adf716915e0be075c
parentd04ecfeaf34114666ce80dfd1be03c439d8151d7 (diff)
downloadteliva-216e56effc28677b0a237b5b0ae834b15aca6f1e.tar.gz
hanoi.lua now working
There's something strange in the combination of Lua 5.1 and lcurses:
window.getch() returns a char but curses.getch() returns an int.
-rw-r--r--src/hanoi.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hanoi.lua b/src/hanoi.lua
index b0a75cd..c4080ea 100644
--- a/src/hanoi.lua
+++ b/src/hanoi.lua
@@ -53,10 +53,10 @@ end
 
 local function update(screen)
   screen:mvaddstr(screen:lines()-2, 5, "tower to remove top disk from? ")
-  local from = string.byte(screen:getch()) - 96
+  local from = screen:getch() - 96
   curses.refresh()
   screen:mvaddstr(screen:lines()-1, 5, "tower to stack it on? ")
-  local to = string.byte(screen:getch()) - 96
+  local to = screen:getch() - 96
   curses.refresh()
   make_move(from, to)
 end