lualoader: Use "local function x()" instead of "local x = function()"

The latter is good, but the former is more elegant and clear about what 'x'
is. Adopt it, preferably only using the latter kind of notation where needed
as values for tables.
This commit is contained in:
Kyle Evans 2018-02-23 04:03:07 +00:00
parent b65c0c07b2
commit 9ed6f9efda
5 changed files with 8 additions and 8 deletions

View File

@ -38,7 +38,7 @@ local cli = {}
-- Defaults to nil and "" respectively.
-- This will also parse arguments to autoboot, but the with_kernel argument
-- will need to be explicitly overwritten to false
local parse_boot_args = function(argv, with_kernel)
local function parse_boot_args(argv, with_kernel)
if with_kernel == nil then
with_kernel = true
end

View File

@ -336,7 +336,7 @@ function config.loadkernel(other_kernel)
local flags = loader.getenv("kernel_options") or ""
local kernel = other_kernel or loader.getenv("kernel")
local try_load = function (names)
local function try_load(names)
for name in names:gmatch("([^;]+)%s*;?") do
local r = loader.perform("load " .. flags ..
" " .. name)
@ -347,7 +347,7 @@ function config.loadkernel(other_kernel)
return nil
end
local load_bootfile = function()
local function load_bootfile()
local bootfile = loader.getenv("bootfile")
-- append default kernel name

View File

@ -33,7 +33,7 @@ local config = require("config")
local core = {}
local compose_loader_cmd = function(cmd_name, argstr)
local function compose_loader_cmd(cmd_name, argstr)
if argstr ~= nil then
cmd_name = cmd_name .. " " .. argstr
end

View File

@ -45,7 +45,7 @@ local orb
local none
local none_shifted = false
local menu_entry_name = function(drawing_menu, entry)
local function menu_entry_name(drawing_menu, entry)
local name_handler = drawer.menu_name_handlers[entry.entry_type]
if name_handler ~= nil then
@ -57,7 +57,7 @@ local menu_entry_name = function(drawing_menu, entry)
return entry.name
end
local shift_brand_text = function(shift)
local function shift_brand_text(shift)
drawer.brand_position.x = drawer.brand_position.x + shift.x
drawer.brand_position.y = drawer.brand_position.y + shift.y
drawer.menu_position.x = drawer.menu_position.x + shift.x

View File

@ -38,7 +38,7 @@ local drawer = require("drawer")
local menu = {}
local OnOff = function(str, b)
local function OnOff(str, b)
if b then
return str .. color.escapef(color.GREEN) .. "On" ..
color.escapef(color.WHITE)
@ -48,7 +48,7 @@ local OnOff = function(str, b)
end
end
local bootenvSet = function(env)
local function bootenvSet(env)
loader.setenv("vfs.root.mountfrom", env)
loader.setenv("currdev", env .. ":")
config.reload()