From 9ed6f9efdad4d5a24d769dc7a048f5aa8c6672df Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Fri, 23 Feb 2018 04:03:07 +0000 Subject: [PATCH] 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. --- stand/lua/cli.lua | 2 +- stand/lua/config.lua | 4 ++-- stand/lua/core.lua | 2 +- stand/lua/drawer.lua | 4 ++-- stand/lua/menu.lua | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index 46430d33244e..db17a8c195d6 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -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 diff --git a/stand/lua/config.lua b/stand/lua/config.lua index afc5c42f15b9..efad00efbe62 100644 --- a/stand/lua/config.lua +++ b/stand/lua/config.lua @@ -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 diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 188612e953ef..01a27a850dc9 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -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 diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 936b813fd438..86697f7070ce 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -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 diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index 433b05640962..6f09b3e1bca9 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -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()