26.890
Bearbeitungen
(+ tableConcatNil()) |
(tableConcatNil() + nil Handling) |
||
| Zeile 142: | Zeile 142: | ||
-- Default sep ist " " | -- Default sep ist " " | ||
-- {nil, 2, nil, 4, nil, ["a"]="b"} wird zu "2 4" | -- {nil, 2, nil, 4, nil, ["a"]="b"} wird zu "2 4" | ||
local s = "" | local s | ||
if t ~= nil then | |||
s = "" | |||
-- höchsten Index ermitteln | |||
local i_max = 0 | |||
for i, _ in pairs(t) do | |||
if type(i) == "number" and i > i_max then | |||
i_max = i | |||
end | |||
end | end | ||
-- alle Indizes durchiterieren | |||
for i = 1, i_max do | |||
if not p.isEmpty(t[i]) then | |||
if s ~= "" then | |||
s = s .. (sep or " ") | |||
end | |||
s = s .. t[i] | |||
end | end | ||
end | end | ||
end | end | ||