Modul:Common: Unterschied zwischen den Versionen

+ shallowcopy
Keine Bearbeitungszusammenfassung
(+ shallowcopy)
Zeile 156: Zeile 156:
     return toprint
     return toprint
end
end
function shallowcopy(orig)
    local orig_type = type(orig)
    local copy
    if orig_type == 'table' then
        copy = {}
        for orig_key, orig_value in pairs(orig) do
            copy[orig_key] = orig_value
        end
    else -- number, string, boolean, etc
        copy = orig
    end
    return copy
end
return p
return p