stand/lua: Call menu_entries if it's a function
If we've fetched menu.entries and it turns out it's a function, call it to get the actual menu entries. This will be used to swap multi-/single- user boot options if we're booting single user by default (boot_single="YES" in loader.conf(5)). It can also be used fairly easily for other non-standard situations.
This commit is contained in:
parent
e07fc39c14
commit
2e716cec23
@ -167,7 +167,9 @@ function drawer.drawmenu(m)
|
|||||||
local alias_table = {};
|
local alias_table = {};
|
||||||
local entry_num = 0;
|
local entry_num = 0;
|
||||||
local menu_entries = m.entries;
|
local menu_entries = m.entries;
|
||||||
|
if (type(menu_entries) == "function") then
|
||||||
|
menu_entries = menu_entries();
|
||||||
|
end
|
||||||
for line_num, e in ipairs(menu_entries) do
|
for line_num, e in ipairs(menu_entries) do
|
||||||
-- Allow menu items to be conditionally visible by specifying
|
-- Allow menu items to be conditionally visible by specifying
|
||||||
-- a visible function.
|
-- a visible function.
|
||||||
|
Loading…
Reference in New Issue
Block a user