Simplified default definiton and stopped modifying values in complete_valid_sides

This commit is contained in:
Cam B 2021-01-23 17:47:35 +00:00
parent e27451cd1d
commit 9f4e9c8c4c

@ -233,13 +233,16 @@ local function invert_booleans(tab)
end end
return inversion return inversion
end end
local valid_sides_default_true = {B=true, R=true, F=true, L=true, D=true, U=true} local valid_sides_default_true = Tbl(DirToSide)
local valid_sides_default_false = invert_booleans(valid_sides_default_true) local valid_sides_default_false = invert_booleans(valid_sides_default_true)
local function complete_valid_sides(valid_sides, existing_defaults) local function complete_valid_sides(valid_sides, existing_defaults)
local valid_sides_complete = valid_sides or {} local valid_sides_complete = {}
for side, default_value in pairs(existing_defaults) do for side, default_value in pairs(existing_defaults) do
if valid_sides_complete[side] == nil then local new_value = valid_sides[side]
if new_value == nil then
valid_sides_complete[side] = default_value valid_sides_complete[side] = default_value
else
valid_sides_complete[side] = new_value
end end
end end
return valid_sides_complete return valid_sides_complete