From 2e716cec23f1563ddcc65bea7bd6bc89557bb16a Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 19 Feb 2018 16:35:46 +0000 Subject: [PATCH] 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. --- stand/lua/drawer.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 9542ff55967..2ff6af877ad 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -167,7 +167,9 @@ function drawer.drawmenu(m) local alias_table = {}; local entry_num = 0; 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 -- Allow menu items to be conditionally visible by specifying -- a visible function.