local SortPls = {
    "Apple",
    "Corn",
    "Juice",
    "Beans",
    "Plums",
},

function SortTable (t, f)
    local a = {}
    
    for n in pairs(t) do
        table.insert(a, n)
    end
    
    table.sort(a, f)
    local i = 0
    local iter = function()
        i = i + 1
        if a[i] == nil then
            return nil
        else
            return a[i], t[a[i]]
        end
    end
    
    return iter
end

SortTable(SortPls)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: