LuaGamer

BankOS v.0.10 beta nice code

Aug 13th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1.   print ("miletokm ", "feettokg ","calendar ","notice ", "string")--Список функций
  2.   local function miletokm()--мили в километры
  3.      print ("Введите кол-во миль")
  4.      local mtk = io.read()
  5.      print (mtk, "mile = ", mtk * 1.61, "km")
  6.   end
  7.   local function feettokg()--футы
  8.      print ("Введите кол-во футов")
  9.      local ptk = io.read()
  10.      print (ptk, "feets =", ptk * 0.45, "kg")
  11.   end
  12.   local function calendar()--календарь
  13.      io.write ("Дата: ")
  14.      local var = os.date()
  15.      print (var)
  16.   end
  17.   local function notice()--уведомление
  18.      print ("Введите кол-во секунд")
  19.      local t = tonumber(io.read())
  20.      local n = io.read()
  21.      os.sleep(t)
  22.      print (n)
  23.   end
  24.   local function string()--строка
  25.      add1 = io.read()
  26.      s1 = tonumber(io.read())
  27.      add2 = io.read()
  28.      s2 = tonumber (io.read())
  29.      add3 = io.read()
  30.      s3 = tonumber (io.read())
  31.      add4 = io.read()
  32.      s4 = tonumber (io.read())
  33.      add5 = io.read()
  34.      s5 = tonumber (io.read())
  35.  
  36.    while true do--Печатаем рекламу в бесконечном цикле, который можно остановить только ошибкой
  37.      print (add1)
  38.      os.sleep(s1)
  39.      print (add2)
  40.      os.sleep(s2)
  41.      print (add3)
  42.      os.sleep(s3)
  43.      print (add4)
  44.      os.sleep(s4)
  45.      print (add5)
  46.      os.sleep(s5)
  47.   end
  48. end
  49.  local exit=false
  50.  while not exit do
  51.   local control = io.read()--Здесь вас спрашивают, какаю функцию вы хотите использовать
  52.      if control == "miletokm" then miletokm()
  53.      elseif control == "feettokg" then feettokg()
  54.      elseif control == "calendar" then calendar()
  55.      elseif control == "notice" then notice()
  56.      elseif control == "stop" then exit = true
  57.      elseif control == "string" then string()
  58.      elseif control == "help" then print ("miletokm ", "feettokg ","calendar ","notice ", "string")--Список функций
  59.      else print ("Такой функции не найдено")
  60.      end
  61.  end
Add Comment
Please, Sign In to add comment