menu.lua (a51f9f0c480fc3d10f5938c91ea0a1dd82c10fb1) menu.lua (4f437f9eab22fa9ba21dbcabe253e13de5dde71d)
1--
2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
3-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org>
4-- All rights reserved.
5--
6-- Redistribution and use in source and binary forms, with or without
7-- modification, are permitted provided that the following conditions
8-- are met:

--- 51 unchanged lines hidden (view full) ---

60 [core.MENU_ENTRY] = function(current_menu, entry)
61 -- run function
62 entry.func()
63 end,
64 [core.MENU_CAROUSEL_ENTRY] = function(current_menu, entry)
65 -- carousel (rotating) functionality
66 local carid = entry.carousel_id
67 local caridx = config.getCarouselIndex(carid)
1--
2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
3-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org>
4-- All rights reserved.
5--
6-- Redistribution and use in source and binary forms, with or without
7-- modification, are permitted provided that the following conditions
8-- are met:

--- 51 unchanged lines hidden (view full) ---

60 [core.MENU_ENTRY] = function(current_menu, entry)
61 -- run function
62 entry.func()
63 end,
64 [core.MENU_CAROUSEL_ENTRY] = function(current_menu, entry)
65 -- carousel (rotating) functionality
66 local carid = entry.carousel_id
67 local caridx = config.getCarouselIndex(carid)
68 local choices = entry.items()
69
68 local choices = entry.items
69 if type(choices) == "function" then
70 choices = choices()
71 end
70 if #choices > 0 then
71 caridx = (caridx % #choices) + 1
72 config.setCarouselIndex(carid, caridx)
73 entry.func(caridx, choices[caridx], choices)
74 end
75 end,
76 [core.MENU_SUBMENU] = function(current_menu, entry)
77 -- recurse

--- 329 unchanged lines hidden ---
72 if #choices > 0 then
73 caridx = (caridx % #choices) + 1
74 config.setCarouselIndex(carid, caridx)
75 entry.func(caridx, choices[caridx], choices)
76 end
77 end,
78 [core.MENU_SUBMENU] = function(current_menu, entry)
79 -- recurse

--- 329 unchanged lines hidden ---