Anonymous

Module:Shared: Difference between revisions

From Melvor Idle
no edit summary
(Add factory method to sortDictionary, so that the key/value names can be specified.)
No edit summary
Line 56: Line 56:
     for k, v in pairs(dict) do
     for k, v in pairs(dict) do
     local newValue = factory(k, v) or {key = k, value = v}
     local newValue = nil
    if factory then
    newValue = factory(k, v)
    end
    newValue = newValue or {key = k, value = v}
         table.insert(sortedTable, newValue)
         table.insert(sortedTable, newValue)
     end
     end
2,875

edits