From da56fe38d5b4a4ce72561d37eabefbeb13b84f44 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 20 Feb 2018 04:11:48 +0000 Subject: [PATCH] stand/lua: Move drawer.menu_name_handlers further up As a good candidate for modification, move this table further up in the module to improve visibility. --- stand/lua/drawer.lua | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index efdc7925bf8..b3e57fa11e8 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -32,6 +32,24 @@ local screen = require("screen"); local drawer = {}; +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + drawer.brand_position = {x = 2, y = 1}; drawer.fbsd_logo = { " ______ ____ _____ _____ ", @@ -159,24 +177,6 @@ function drawer.drawscreen(menu_opts) return drawer.drawmenu(menu_opts); end -drawer.menu_name_handlers = { - -- Menu name handlers should take the menu being drawn and entry being - -- drawn as parameters, and return the name of the item. - -- This is designed so that everything, including menu separators, may - -- have their names derived differently. The default action for entry - -- types not specified here is to call and use entry.name(). - [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) - local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = entry.items(); - - if (#choices < caridx) then - caridx = 1; - end - return entry.name(caridx, choices[caridx], choices); - end, -}; - function menu_entry_name(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type];