Skip to content

Commit

Permalink
Replace more simple condition assignments with short-circuit evaluations
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyBars3k committed Jun 2, 2024
1 parent 98ebe23 commit f38aeba
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- @description MB_Buss Driver - Batch add or remove send(s) or receive(s) on selected track(s)
-- @author MonkeyBars
-- @version 2.6.1
-- @changelog Replace simple condition assignments with short-circuit evaluations
-- @version 2.6.2
-- @changelog Replace more simple condition assignments with short-circuit evaluations
-- @provides [main] .
-- [nomain] rtk.lua
-- [nomain] serpent.lua
Expand Down Expand Up @@ -198,7 +198,7 @@ end


function toggleSaveOptions(initialize)
local current_save_options_setting, save_options_checkbox_value
local current_save_options_setting, save_options_checkbox_value, new_option_val

if initialize == "initialize" then
current_save_options_setting = storeRetrieveProjectData(_constant.brand.save_options_key_name)
Expand All @@ -209,13 +209,9 @@ function toggleSaveOptions(initialize)

else
save_options_checkbox_value = _state.routing.options_objs.save_options.value
new_option_val = save_options_checkbox_value and "true" or "false"

if save_options_checkbox_value then
storeRetrieveProjectData(_constant.brand.save_options_key_name, "true")

else
storeRetrieveProjectData(_constant.brand.save_options_key_name, "false")
end
storeRetrieveProjectData(_constant.brand.save_options_key_name, new_option_val)
end
end

Expand Down Expand Up @@ -1532,13 +1528,7 @@ function updateRoutingSettingsBtns(reset)
for btn_name, btn_img_base in pairs(all_btn_img_filename_bases) do
this_btn = _state.routing.settings_objs[btn_name]
this_btn_value = this_btn.value

if reset == "reset" then
new_btn_img_base_state = "_off"

else
new_btn_img_base_state = this_btn_value == 1 and "_on" or "_off"
end
new_btn_img_base_state = (reset == "reset" or this_btn_value == 0) and "_off" or "_on"

this_btn:attr("icon", btn_img_base .. new_btn_img_base_state)
end
Expand Down

0 comments on commit f38aeba

Please sign in to comment.