source: bootcd/isolinux/syslinux-6.03/com32/lua/test/simplemenu.lua

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[e16e8f2]1-- A translation of com32/cmenu/simple.c into Lua
2
3local m = require "cmenu"
4local sl = require "syslinux"
5
6m.init()
7m.set_window_size(1, 1, 23, 78)
8local testing = m.add_named_menu("testing", " Testing ")
9-- demonstrate identifying (named) submenu by number:
10m.add_item("Self Loop", "Go to testing", m.action.SUBMENU, nil, testing)
11m.add_item("Memory Test", "Perform extensive memory testing", m.action.RUN, "memtest")
12m.add_item("Exit this menu", "Go one level up", m.action.EXITMENU, "exit")
13
14local rescue = m.add_menu(" Rescue Options ")
15m.add_item("Linux Rescue", "linresc", m.action.RUN, "linresc")
16m.add_item("Dos Rescue", "dosresc", m.action.RUN, "dosresc")
17m.add_item("Windows Rescue", "winresc", m.action.RUN, "winresc")
18m.add_item("Exit this menu", "Go one level up", m.action.EXITMENU, "exit")
19
20m.add_named_menu("main", " Main Menu ")
21m.add_item("Prepare", "prep", m.action.RUN, "prep")
22m.add_item("Rescue options...", "Troubleshoot a system", m.action.SUBMENU, nil, rescue)
23-- demonstrate identifying submenu by name:
24m.add_item("Testing...", "Options to test hardware", m.action.SUBMENU, "testing")
25m.add_item("Exit to prompt", "Exit the menu system", m.action.EXITMENU, "exit")
26
27-- demonstrate finding menu explicitly:
28local action, data = m.showmenus(m.find_menu_num("main"))
29
30if action == m.action.RUN then
31  sl.run_command (data)
32else
33  print (action, data)
34end
Note: See TracBrowser for help on using the repository browser.