I decided to make a graphical menu that automatically generates multiple pages and places the buttons appropriately. The focus of this is to make it easy to use. If you have any ideas or suggestions for this, please comment.

pastebin get 3eMtT5vX

Example:


os.loadAPI( "button" ) --#let's assume I named it button
local menu = button.makeButtonPages( colors.blue, colors.lightBlue, colors.white, "Option 1", "Option 2", "Option 3", "This one's a little longer" )
menu:render()

while true do
  local event = { menu:handleEvents( os.pullEvent() ) } --#note: if handleEvents doesn't click a button, it'll return what was given to it
  if event[ 1 ] == "button_click" then --#handleEvents returns a button_click event if a button was clicked
    term.setBackgroundColor( colors.black )
    term.clear()
    term.setCursorPos( 1, 1 )
    print( event[ 2 ] ) --#the second parameter is the text of the button clicked (which doubles as it's name)
    break
  end
end

The background will be blue, the buttons lightBlue, and the text will be white. I made 4 buttons, which should automatically fit to the longest text (in this case the fourth).