Advertisement
emiellr

menu.lua

Jul 6th, 2022 (edited)
783
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None
  1. local menuOption = require "menuOption"
  2. local menu = {}
  3. menu.__index = menu
  4.  
  5. function menu.new()
  6.     local newMenu = setmetatable({}, menu)
  7.  
  8.     newMenu.options = {}
  9.     table.insert(newMenu.options, menuOption.new(1, "Exit"))
  10.     print(newMenu.options.text)
  11.     return newMenu
  12. end
  13.  
  14. function menu:run()
  15.     menu:clearScreen()
  16.     --menu:listOptions()
  17. end
  18.  
  19. function menu:listOptions()
  20.     for i, menuOption in ipairs(self.options) do
  21.         print(i..menuOption.text)
  22.     end
  23. end
  24.  
  25. function menu:clearScreen()
  26.     term.clear()
  27. end
  28.  
  29. return menu
Advertisement
RAW Paste Data Copied
Advertisement