--!name Hello eOctavo
--!icon code
--!category Examples
--
-- Minimal Snail-compatible Lua app for eOctavo.
-- Copy to /apps/hello.lua on the SD card.

local n = 0

function start()
  local s = snail.load()
  if s then n = tonumber(s) or 0 end
end

function key(k)
  if k == "up" or k == "right" or k == "ok" then
    n = n + 1
  elseif k == "down" or k == "left" then
    n = n - 1
  end
  snail.save(tostring(n))
end

function draw()
  snail.title("Hello eOctavo")
  snail.text("Counter: " .. tostring(n))
  snail.gap()
  snail.small("UP/OK +1   DOWN -1")
  snail.small("BACK leaves the app")
  snail.hint("Snail-compatible Lua")
end
