lua-users home
lua-l archive

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


But if you do, in fact, need your parameters to be traversed in
order, and that order is consistent throughout, this will work:

    -- Specify order for parameters.
    local paramNames = "name server IP domain class license JDK " ..
                       "WebLogicVersion Console instance port"

    function Project (table)

        -- Traverse string keys in order.  Values are parameters.
        for k in string.gmatch(paramNames, "%S+") do
            if table[k] then print(k,table[k]) end
        end

        -- Traverse number keys.  Values are subtables.
        for i,v in ipairs(table) do
            Project(v)
        end

    end


-Bret