Skip to content

Commit

Permalink
Simplified default definiton and stopped modifying values in complete…
Browse files Browse the repository at this point in the history
…_valid_sides
  • Loading branch information
mt-curated committed Jan 23, 2021
1 parent e27451c commit 9f4e9c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tube_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,16 @@ local function invert_booleans(tab)
end
return inversion
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 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
if valid_sides_complete[side] == nil then
local new_value = valid_sides[side]
if new_value == nil then
valid_sides_complete[side] = default_value
else
valid_sides_complete[side] = new_value
end
end
return valid_sides_complete
Expand Down

0 comments on commit 9f4e9c8

Please sign in to comment.