FANDOM


local p = {};
 
function p.Build(frame)
	--Import Arguments
	--This call is necessary to read in data from the page
	data = frame.args;
 
	--create output variable
	local out = "";
 
    --Get separator, add zero-width space for automatic a break points
    local sep = pfetch("separator");
    if not sep then sep = "​" else sep = "​" .. sep end
 
    --Concatenate all arguments, adding separators.
    for i, v in ipairs(data) do
        out = out .. v .. sep;
    end
 
    out = string.sub(out, 1, -(string.len(sep) + 1) ); -- Removing extra separator from end
 
    --return result
    return out;
end
 
--Basic_Functions_______________________________________________________________
 
--Protected fetch function-reads in data and returns errors as false
function pfetch(target)
    local temp; --temporary variable
    if (select(1,pcall(function() temp=data[target]; end))) then
        --attempt fetch, use pcall() to catch any errors, and return the requested data on success.
 
        return temp;
    else
        --if read attempt failed, return nil.
        return nil;
    end
end
 
return p;
Community content is available under CC-BY-SA unless otherwise noted.