Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:ObbyInfobox: Difference between revisions

From Obby Wiki
Created page with "-- roblox.fandom.com local get_args = require('Module:Arguments') local p = {} function p.wrap_function(f, ppc) if ppc then return function(frame) return frame:preprocess(func(get_args(frame))) end else return function(frame) return func(get_args(frame)) end end end return p"
 
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- roblox.fandom.com
-- inspired by roblox.fandom.com
local get_args = require('Module:Arguments')


local p = {}
local utils = require('Module:Utils')
local config_external = require('Module:Config_external')


function p.wrap_function(f, ppc)
local media = config_external.media
    if ppc then
local platforms = config_external.platforms
        return function(frame)
 
            return frame:preprocess(func(get_args(frame)))
local function format_media(args)
        end
    local str = ''
     else
 
         return function(frame)
     for i, v in pairs(media) do
             return func(get_args(frame))
         if args[i] then
             str = str .. ' ' .. (' [[File:' .. v.file .. '|28px|link=' .. v.url_form:format(args[i]) .. '|alt="' .. v.display .. '"]]')
         end
         end
     end
     end
    return str
end
end


local function format_platforms(args)
    local str = ''
    for i, v in pairs(platforms) do
        if args[i] then
            str = str .. ' ' .. (' [[File:' .. v.file .. '|28px|alt="Supports ' .. v.display .. '"]]')
        end
    end


    return str
end


return p
return {
    ['format_media'] = utils.wrap_function(format_media, true);
    ['format_platforms'] = utils.wrap_function(format_platforms, true);
}

Latest revision as of 07:10, 4 April 2025

Documentation for this module may be created at Module:ObbyInfobox/doc

-- inspired by roblox.fandom.com

local utils = require('Module:Utils')
local config_external = require('Module:Config_external')

local media = config_external.media
local platforms = config_external.platforms

local function format_media(args)
    local str = ''

    for i, v in pairs(media) do
        if args[i] then
            str = str .. ' ' .. (' [[File:' .. v.file .. '|28px|link=' .. v.url_form:format(args[i]) .. '|alt="' .. v.display .. '"]]')
        end
    end

    return str
end

local function format_platforms(args)
    local str = ''

    for i, v in pairs(platforms) do
        if args[i] then
            str = str .. ' ' .. (' [[File:' .. v.file .. '|28px|alt="Supports ' .. v.display .. '"]]')
        end
    end

    return str
end

return {
    ['format_media'] = utils.wrap_function(format_media, true);
    ['format_platforms'] = utils.wrap_function(format_platforms, true);
}