FANDOM


-- Intra-wiki Utilities
-- Used for metamodule, or for template use
 
--[==[Modules]==]--
local getArgs = require("Dev:Arguments").getArgs;
 
--[==[Utils Module]==]--
local utils = {};
 
-- Metamodules
utils.create_wrapper = function(func, firstArg)
    -- Wrap a metamodule function for use in templates
    return function(frame)
        return frame:preprocess(firstArg and func(getArgs(frame)[1]) or func(getArgs(frame)));
    end
end
 
utils._trim = function(str)
    -- Trims leading and trailing whitespace from a string
    return str:match("^%s*(.-)%s*$");
end
 
-- Template modules
utils.trim = utils.create_wrapper(utils._trim, true);
 
-------------------------------------------------------------------
return utils;

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.