Problem with statement

Hello everyone. This image is part of a form created with a game lua code. I have a problem with the statement: this is my code
 

function checkDuration(key, expirationTime) local min if ((key.duration.minimum.enabled) and (key.duration.minimum.value \< expirationTime)) then min = true elseif (not key.duration.minimum.enabled) then min = true else min = false end if min then return true end end

Where

• enabled = returns true if the checkbox is selected
• value = returns the editbox’s content

I would make sure that if the checkbox is not selected or, if selected, and the editbox value is less than of expirationTime, the function checkDuration returns true, but I can not find the right combination with the statement. Can you help me?

How about something like this…

[lua]

function checkDuration(key, expirationTime)

    local min = false

    if key.duration.minimum.enabled and key.duration.minimum.value < expirationTime then return true end

    if not key.duration.minimum.enabled then return true end

    return false

end

[/lua]

function checkDuration(key, expirationTime) &nbsp;&nbsp;&nbsp; local min = false &nbsp; &nbsp;&nbsp;&nbsp; if key.duration.minimum.enabled and key.duration.minimum.value \< expirationTime then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min = true &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; if not key.duration.minimum.enabled then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min = true &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; return min end

Maybe something like that?

How about something like this…

[lua]

function checkDuration(key, expirationTime)

    local min = false

    if key.duration.minimum.enabled and key.duration.minimum.value < expirationTime then return true end

    if not key.duration.minimum.enabled then return true end

    return false

end

[/lua]

function checkDuration(key, expirationTime) &nbsp;&nbsp;&nbsp; local min = false &nbsp; &nbsp;&nbsp;&nbsp; if key.duration.minimum.enabled and key.duration.minimum.value \< expirationTime then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min = true &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; if not key.duration.minimum.enabled then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min = true &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; return min end

Maybe something like that?