From owner-svn-src-head@freebsd.org Sat Feb 17 04:43:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1060BF0D26D; Sat, 17 Feb 2018 04:43:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF65585F5A; Sat, 17 Feb 2018 04:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CBA917EEE; Sat, 17 Feb 2018 04:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1H4hfd5063117; Sat, 17 Feb 2018 04:43:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1H4hfBI063116; Sat, 17 Feb 2018 04:43:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802170443.w1H4hfBI063116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 17 Feb 2018 04:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329430 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Feb 2018 04:43:42 -0000 Author: kevans Date: Sat Feb 17 04:43:41 2018 New Revision: 329430 URL: https://svnweb.freebsd.org/changeset/base/329430 Log: stand/lua: Address some nits 1.) Instead of string.function(s, ...), use s:function(...) 2.) Don't try to concatenate `res`, it was just tested to be nil 3.) Note that "Loading configuration" is configured modules, and be a little more precise in mentioning what failed ("loading of one or more modules") Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Sat Feb 17 04:33:37 2018 (r329429) +++ head/stand/lua/config.lua Sat Feb 17 04:43:41 2018 (r329430) @@ -38,11 +38,11 @@ function config.setKey(k, n, v) end function config.dumpModules() - print("== Dumping modules") + print("== Dumping modules"); for k, v in pairs(modules) do print(k, v.load); end - print("== Dump ended") + print("== Dump ended"); end local pattern_table = { @@ -57,7 +57,7 @@ local pattern_table = { if modules[k] == nil then modules[k] = {}; end - modules[k].load = string.upper(v); + modules[k].load = v:upper(); end }, -- module_name="value" @@ -133,9 +133,9 @@ local pattern_table = { function config.isValidComment(c) if c ~= nil then - local s = string.match(c, "^%s*#.*"); + local s = c:match("^%s*#.*"); if s == nil then - s = string.match(c, "^%s*$"); + s = c:match("^%s*$"); end if s == nil then return false; @@ -221,13 +221,13 @@ function config.parse(name, silent) local n = 1; local status = true; - for line in string.gmatch(text, "([^\n]+)") do + for line in text:gmatch("([^\n]+)") do - if string.match(line, "^%s*$") == nil then + if line:match("^%s*$") == nil then local found = false; for i, val in ipairs(pattern_table) do - local k, v, c = string.match(line, val.str); + local k, v, c = line:match(val.str); if k ~= nil then found = true; @@ -287,7 +287,7 @@ function config.loadkernel() if res ~= nil then return true; else - print("Failed to load kernel '"..res.."'"); + print("No kernel set, failed to load from module_path"); return false; end else @@ -338,7 +338,7 @@ function config.load(file) local f = loader.getenv("loader_conf_files"); if f ~= nil then - for name in string.gmatch(f, "([%w%p]+)%s*") do + for name in f:gmatch("([%w%p]+)%s*") do if not config.parse(name) then -- print("Failed to parse configuration: '"..name.."'"); end @@ -348,9 +348,9 @@ function config.load(file) print("Loading kernel..."); config.loadkernel(); - print("Loading configurations..."); + print("Loading configured modules..."); if not config.loadmod(modules) then - print("Could not load configurations!"); + print("Could not load one or more modules!"); end end