Author: kevans Date: Mon Feb 19 01:59:41 2018 New Revision: 329547 URL: https://svnweb.freebsd.org/changeset/base/329547
Log: stand/lua: Allow menu items to be conditionally (in)visible This will be used to conditionally show/hide the boot environment menu. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Mon Feb 19 01:49:19 2018 (r329546) +++ head/stand/lua/drawer.lua Mon Feb 19 01:59:41 2018 (r329547) @@ -167,6 +167,11 @@ function drawer.drawmenu(m) local alias_table = {}; local entry_num = 0; for line_num, e in ipairs(m) do + -- Allow menu items to be conditionally visible by specifying + -- a visible function. + if (e.visible ~= nil) and (not e.visible()) then + goto continue + end if (e.entry_type ~= core.MENU_SEPARATOR) then entry_num = entry_num + 1; screen.setcursor(x, y + line_num); @@ -197,6 +202,7 @@ function drawer.drawmenu(m) screen.setcursor(x, y + line_num); print(e.name()); end + ::continue:: end return alias_table; end _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"