Module:Array: Difference between revisions
Jump to navigation
Jump to search
m Protected "Module:Array" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
No edit summary |
||
| Line 127: | Line 127: | ||
-- join as sentence | -- join as sentence | ||
if sentence ~= nil then | if sentence ~= nil then | ||
if #array == 0 then return | if #array == 0 then return '' | ||
elseif #array == 1 then | elseif #array == 1 then result = array[1] | ||
elseif #array == 2 then | elseif #array == 2 then result = array[1] .. sentence_last .. array[2] | ||
else | else | ||
local last = table.remove(array, #array) | local last = table.remove(array, #array) | ||
| Line 139: | Line 139: | ||
-- join with join string | -- join with join string | ||
else | else | ||
result = table.concat(array, join):gsub('{newline}', '\n'):gsub('{space}', ' ')--in case joining string contains keyword | |||
end | end | ||
result = prefix .. result .. suffix | result = prefix .. result .. suffix | ||