1 --[[ Towers of hanoi - Lua 5.1 ]]--
3 local move = function(a, b)
8 hanoi = function(n, orig, pivot, dest)
25 hanoi(n-2, orig, pivot, dest)
27 hanoi(n-2, dest, orig, pivot)
29 hanoi(n-1, pivot, orig, dest)
32 io.write "Value of N: "
33 local n = io.read "*n"
35 if type(n) == 'number' then
38 io.stderr "Value given is not a number.\n"
42 hanoi(n, 'Left', 'Center', 'Right')