Documentation for this module may be created at ಮಾಡ್ಯೂಲ್:Join/doc

--[[
Join
 
Joins all non null arguments together, the first argument is the separator

    {{ #invoke:join | join | sep | one | two | three }}
/*
*/
    if args[1] == nil then
        local pFrame = frame:getParent();
        args = pFrame.args;
        for k,v in pairs( frame.args ) do
            args[k] = v;
        end
    end

]]

local join = {}

function join.join(frame)
    local res='';
    local args = {};
    for k,v in pairs( frame.args ) do
      if v ~= nil and v ~= '' then
         table.insert(args,v)
         --res = res .. '[' .. k .. ']=' ..v
      end
    end
    local sep = args[1];
    res = table.concat( args, sep, 2, j );
    return res
end

function join.join2(frame)
    local res='';
    local args = {};
    for k,v in pairs( frame.args ) do
      if v ~= nil and v ~= '' then
         table.insert(args,v)
         --res = res .. '[' .. k .. ']=' ..v
      end
    end

    local sep = args[1];
    local sep2 = args[2];
    if #args < 3 then
      res = ''
    elseif #args == 3 then
      res = args[3]
    elseif #args == 4 then
      res = args[3] .. sep2 .. args[4]
    else
      res = table.concat( args, sep, 3, #args-1 );
      res = res .. sep2 .. args[#args];
    end
    return res
end

function join.concat(frame)
    local res='';
    for k,v in pairs( frame.args ) do
         res = res .. v
    end
    return res
end

function join.iconcat(frame)
    local res='';
    for k,v in ipairs( frame.args ) do
         res = res .. v
    end
    return res
end
 
return join