Module:Teste: Difference between revisions

From determinar.ia.br - Determine suas informações
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
  function p.testarItem()
function p.testarItem()
      local entity = mw.wikibase.getEntity('Q1')
    local entity = mw.wikibase.getEntity('Q1')
      if entity then
    if entity then
          return "Entidade encontrada! Label: " .. (entity.labels.pt and entity.labels.pt.value or "sem label pt")
        local idiomas = {}
      else
        for lang, _ in pairs(entity.labels or {}) do
          return "Entidade NÃO encontrada — self-client não está funcionando"
            table.insert(idiomas, lang)
      end
        end
  end
        return "Entidade encontrada! Idiomas de label disponíveis: " .. table.concat(idiomas, ", ")
  return p
    else
        return "Entidade NÃO encontrada — self-client não está funcionando"
    end
end
return p

Revision as of 11:06, 1 August 2026

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

local p = {}
function p.testarItem()
    local entity = mw.wikibase.getEntity('Q1')
    if entity then
        local idiomas = {}
        for lang, _ in pairs(entity.labels or {}) do
            table.insert(idiomas, lang)
        end
        return "Entidade encontrada! Idiomas de label disponíveis: " .. table.concat(idiomas, ", ")
    else
        return "Entidade NÃO encontrada — self-client não está funcionando"
    end
end
return p