Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 04:03:07 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329856 - head/stand/lua
Message-ID:  <201802230403.w1N437lu053638@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Fri Feb 23 04:03:07 2018
New Revision: 329856
URL: https://svnweb.freebsd.org/changeset/base/329856

Log:
  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.

Modified:
  head/stand/lua/cli.lua
  head/stand/lua/config.lua
  head/stand/lua/core.lua
  head/stand/lua/drawer.lua
  head/stand/lua/menu.lua

Modified: head/stand/lua/cli.lua
==============================================================================
--- head/stand/lua/cli.lua	Fri Feb 23 03:36:24 2018	(r329855)
+++ head/stand/lua/cli.lua	Fri Feb 23 04:03:07 2018	(r329856)
@@ -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

Modified: head/stand/lua/config.lua
==============================================================================
--- head/stand/lua/config.lua	Fri Feb 23 03:36:24 2018	(r329855)
+++ head/stand/lua/config.lua	Fri Feb 23 04:03:07 2018	(r329856)
@@ -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

Modified: head/stand/lua/core.lua
==============================================================================
--- head/stand/lua/core.lua	Fri Feb 23 03:36:24 2018	(r329855)
+++ head/stand/lua/core.lua	Fri Feb 23 04:03:07 2018	(r329856)
@@ -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

Modified: head/stand/lua/drawer.lua
==============================================================================
--- head/stand/lua/drawer.lua	Fri Feb 23 03:36:24 2018	(r329855)
+++ head/stand/lua/drawer.lua	Fri Feb 23 04:03:07 2018	(r329856)
@@ -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

Modified: head/stand/lua/menu.lua
==============================================================================
--- head/stand/lua/menu.lua	Fri Feb 23 03:36:24 2018	(r329855)
+++ head/stand/lua/menu.lua	Fri Feb 23 04:03:07 2018	(r329856)
@@ -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()



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802230403.w1N437lu053638>