lualoader: Don't explicitly index tables without reason

These indices were assigned the same values as they would've been implicitly
assigned anyways.

While here, throw terminating commas after the last value of tables.
This commit is contained in:
Kyle Evans 2018-02-25 03:30:24 +00:00
parent 1c2529ab32
commit e1a8835aa8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329944

View File

@ -33,95 +33,94 @@ local config = {}
local modules = {} local modules = {}
local pattern_table
local carousel_choices = {} local carousel_choices = {}
pattern_table = { local pattern_table = {
[1] = { {
str = "^%s*(#.*)", str = "^%s*(#.*)",
process = function(_, _) end process = function(_, _) end,
}, },
-- module_load="value" -- module_load="value"
[2] = { {
str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_load%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
if modules[k] == nil then if modules[k] == nil then
modules[k] = {} modules[k] = {}
end end
modules[k].load = v:upper() modules[k].load = v:upper()
end end,
}, },
-- module_name="value" -- module_name="value"
[3] = { {
str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_name%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
config.setKey(k, "name", v) config.setKey(k, "name", v)
end end,
}, },
-- module_type="value" -- module_type="value"
[4] = { {
str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_type%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
config.setKey(k, "type", v) config.setKey(k, "type", v)
end end,
}, },
-- module_flags="value" -- module_flags="value"
[5] = { {
str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_flags%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
config.setKey(k, "flags", v) config.setKey(k, "flags", v)
end end,
}, },
-- module_before="value" -- module_before="value"
[6] = { {
str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_before%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
config.setKey(k, "before", v) config.setKey(k, "before", v)
end end,
}, },
-- module_after="value" -- module_after="value"
[7] = { {
str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_after%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
config.setKey(k, "after", v) config.setKey(k, "after", v)
end end,
}, },
-- module_error="value" -- module_error="value"
[8] = { {
str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w_]+)_error%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
config.setKey(k, "error", v) config.setKey(k, "error", v)
end end,
}, },
-- exec="command" -- exec="command"
[9] = { {
str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*exec%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, _) process = function(k, _)
if loader.perform(k) ~= 0 then if loader.perform(k) ~= 0 then
print("Failed to exec '" .. k .. "'") print("Failed to exec '" .. k .. "'")
end end
end end,
}, },
-- env_var="value" -- env_var="value"
[10] = { {
str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)", str = "^%s*([%w%p]+)%s*=%s*\"([%w%s%p]-)\"%s*(.*)",
process = function(k, v) process = function(k, v)
if config.setenv(k, v) ~= 0 then if config.setenv(k, v) ~= 0 then
print("Failed to set '" .. k .. print("Failed to set '" .. k ..
"' with value: " .. v .. "") "' with value: " .. v .. "")
end end
end end,
}, },
-- env_var=num -- env_var=num
[11] = { {
str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)", str = "^%s*([%w%p]+)%s*=%s*(%d+)%s*(.*)",
process = function(k, v) process = function(k, v)
if config.setenv(k, v) ~= 0 then if config.setenv(k, v) ~= 0 then
print("Failed to set '" .. k .. print("Failed to set '" .. k ..
"' with value: " .. v .. "") "' with value: " .. v .. "")
end end
end end,
} },
} }
local function readFile(name, silent) local function readFile(name, silent)