Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:


function p.getName(frame)
function p.getName(frame)
    -- Holt die ID aus der Vorlage (z.B. 501)
     local id = tonumber(frame.args[1])
     local id = tonumber(frame.args[1])
     if not id then return "ID fehlt" end
     if not id then return "ID fehlt" end


    -- Greift auf deine Datenbank in Modul:ItemData zu
    -- mw.loadData ist extrem schnell für 66.000 Zeilen
     local data = mw.loadData('Modul:ItemData')
     local data = mw.loadData('Modul:ItemData')


    -- Sucht den Namen
     if data and data[id] then
     if data and data[id] then
         return data[id].identifiedDisplayName or ("Item " .. id)
         return data[id].identifiedDisplayName or ("Item " .. id)

Version vom 27. Dezember 2025, 19:17 Uhr

local p = {}

function p.getName(frame)

   local id = tonumber(frame.args[1])
   if not id then return "ID fehlt" end
   local data = mw.loadData('Modul:ItemData')
   if data and data[id] then
       return data[id].identifiedDisplayName or ("Item " .. id)
   else
       return "Item " .. id
   end

end

return p