lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 26 Feb 2008, at 14:14, Mark Hamburg wrote:
The primary case I find myself faking continue in Lightroom is loops of the
form:

    while true do repeat

        if not test_condition_1() then
            wait_for_semaphore_1()
            break -- continue
        end

        if not test_condition_2() then
            wait_for_semaphore_2()
            break -- continue
        end

        -- conditions 1 and 2 now hold

    until true end


I'm probably missing something, but what's wrong with the following code?

while true do

    if not test_condition_1() then
        wait_for_semaphore_1()

    elseif not test_condition_2() then
        wait_for_semaphore_2()

    else
        -- conditions 1 and 2 now hold
    end

end


--
Renato Maia
PhD student at PUC-Rio
__________________________
http://www.inf.puc-rio.br/~maia/