blob: f797a3a17128f66bca73a12a83aca98ca7816e2d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
-- Tools for conditionally loading plugins via lazy
M = {}
M.machines = { 'nest', 'Goose.local' }
local getDefaultmetatable = {
__index = function(tbl, key)
if rawget(tbl, key) then
return tbl[key]
else
return tbl["default"]
end
end
}
-- Create a table for each machine with a default value
-- current machines: nest, Goose.local
M.createProfiles = function(default)
local profiles = {}
profiles.default = default
for _, machine in ipairs(M.machines) do
profiles[machine] = default
end
setmetatable(profiles, getDefaultmetatable)
return profiles
end
return M
|