Module:TileRename

From Feed The Beast Wiki
Jump to: navigation, search

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

local p = {}

function p.rename( f )
    local args = f.args or f
    if f == mw.getCurrentFrame() and args[1] == nil then
        args = f:getParent().args
    else
        f = mw.getCurrentFrame()
    end
    args = require( [[Module:ProcessArgs]] ).norm( args )
    
    local renamed = require( [[Module:Grid/Renames]] )[args[1]];
    if renamed then
        return renamed
    else
        return args[1]
    end
end

function p.getCategory( f )
    local args = f.args or f
    if f == mw.getCurrentFrame() and args[1] == nil then
        args = f:getParent().args
    else
        f = mw.getCurrentFrame()
    end
    args = require( [[Module:ProcessArgs]] ).norm( args )
    
    local renamed = require( [[Module:Grid/Renames]] )[args[1]];
    if renamed then
        return [=[[[Category:Pages using a renamed tile]]]=]
    else
        return ''
    end
end

return p