Form for choosing settings for a game I've created a form to choose the settings. These settings are automatically saved in a file from the game client in this form:

["Setting"] = {
    ["track"] = "Water Shield",
    ["duration"] = {
        ["minimum"] = {
            ["enabled"] = 1,
            ["value"] = 50,
        },
        ["maximum"] = {
        },
    },
    ["stack"] = {
        ["minimum"] = {
        },
        ["maximum"] = {
            ["enabled"] = 1,
            ["value"] = 2,
        },
    },
}


I had previously asked a similar question on how to save the data, but now to load the data I created this function:

function loadSettings()
    local options = { 'duration', 'stack' }
    for i=1, #options do
        local option = options[i]

        if not db[option] then
            db[option] = { minimum = {}, maximum = {} }
        end

            local enabled
            local value

            enabled = db[option].minimum.enabled
            if (enabled) then _G["min"..option].cbutton:SetChecked(1) else _G["min"..option].cbutton:SetChecked(0) end
            value = db[option].minimum.value
            if (value) then _G["min"..option].ebox:SetText(value) else _G["min"..option].ebox:SetText("\00") end

            enabled = db[option].maximum.enabled
            if (enabled) then _G["max"..option].cbutton:SetChecked(1) else _G["max"..option].cbutton:SetChecked(0) end
            value = db[option].maximum.value
            if (value) then _G["max"..option].ebox:SetText(value) else _G["max"..option].ebox:SetText("\00") end


    end
end


Where


db = The "Setting" table
SetChecked(enable) = True to check the button; false to uncheck (boolean)
SetText("text") = Text to be placed in the edit box (string)


Could you help me to make the code less repetitive and more clean and elegant?
On a cursory glance, you can change the statement:

if (enabled) then _G["min"..option].cbutton:SetChecked(1) else _G["min"..option].cbutton:SetChecked(0) end


to

_G["min"..option].cbutton:SetChecked( enabled and 1 or 0 )