Mudanças entre as edições de "Módulo:MapaJson"

De Wiki Gla
Ir para navegação Ir para pesquisar
(Página substituída por 'local p = {} function p.ola(frame) return "Lua está funcionando!" end return p')
Etiqueta: Substituído
 
(9 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
local p = {}
local p = {}


function p.ola(frame)
function p.getDados(frame)
     return "Lua está funcionando!"
     local pageName = frame.args[1] or ''
   
    if pageName == '' then
        return ''
    end
   
    local title = mw.title.new(pageName)
    if not title or not title.exists then
        return ''
    end
   
    local jsonContent = title:getContent() or ''
   
    -- Apenas remover espaços extras
    jsonContent = jsonContent:gsub("\n", "")
    jsonContent = jsonContent:gsub("\r", "")
    jsonContent = jsonContent:gsub("\t", " ")
    jsonContent = jsonContent:gsub("  +", " ")
   
    return jsonContent
end
end


return p
return p

Edição atual tal como às 14h24min de 11 de abril de 2026

A documentação para este módulo pode ser criada em Módulo:MapaJson/doc

local p = {}

function p.getDados(frame)
    local pageName = frame.args[1] or ''
    
    if pageName == '' then
        return ''
    end
    
    local title = mw.title.new(pageName)
    if not title or not title.exists then
        return ''
    end
    
    local jsonContent = title:getContent() or ''
    
    -- Apenas remover espaços extras
    jsonContent = jsonContent:gsub("\n", "")
    jsonContent = jsonContent:gsub("\r", "")
    jsonContent = jsonContent:gsub("\t", " ")
    jsonContent = jsonContent:gsub("  +", " ")
    
    return jsonContent
end

return p