<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AGetNPCImage</id>
	<title>Module:GetNPCImage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mbwiki.stairwaygames.work/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AGetNPCImage"/>
	<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:GetNPCImage&amp;action=history"/>
	<updated>2026-04-20T00:49:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://mbwiki.stairwaygames.work/w/index.php?title=Module:GetNPCImage&amp;diff=28283&amp;oldid=prev</id>
		<title>Ais: Created page with &quot;local p = {}  function p.getImage(frame)     local pageName = frame.args[1] or frame:getParent().args[1] or mw.title.getCurrentTitle().text     local title = mw.title.new(pageName)          if not title or not title.exists then         return &quot;&quot; -- Page doesn&#039;t exist, return empty     end          -- Get the page content     local content = title:getContent()     if not content then         return &quot;&quot;     end          -- Look for the image parameter in InfoboxNPC     -- P...&quot;</title>
		<link rel="alternate" type="text/html" href="https://mbwiki.stairwaygames.work/w/index.php?title=Module:GetNPCImage&amp;diff=28283&amp;oldid=prev"/>
		<updated>2026-02-26T12:27:28Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  function p.getImage(frame)     local pageName = frame.args[1] or frame:getParent().args[1] or mw.title.getCurrentTitle().text     local title = mw.title.new(pageName)          if not title or not title.exists then         return &amp;quot;&amp;quot; -- Page doesn&amp;#039;t exist, return empty     end          -- Get the page content     local content = title:getContent()     if not content then         return &amp;quot;&amp;quot;     end          -- Look for the image parameter in InfoboxNPC     -- P...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.getImage(frame)&lt;br /&gt;
    local pageName = frame.args[1] or frame:getParent().args[1] or mw.title.getCurrentTitle().text&lt;br /&gt;
    local title = mw.title.new(pageName)&lt;br /&gt;
    &lt;br /&gt;
    if not title or not title.exists then&lt;br /&gt;
        return &amp;quot;&amp;quot; -- Page doesn&amp;#039;t exist, return empty&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Get the page content&lt;br /&gt;
    local content = title:getContent()&lt;br /&gt;
    if not content then&lt;br /&gt;
        return &amp;quot;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Look for the image parameter in InfoboxNPC&lt;br /&gt;
    -- Pattern matches: | image = filename.png or |image = filename.png&lt;br /&gt;
    local pattern = &amp;quot;|%s*image%s*=%s*([^%c|]+)&amp;quot;&lt;br /&gt;
    local imageName = string.match(content, pattern)&lt;br /&gt;
    &lt;br /&gt;
    if imageName then&lt;br /&gt;
        -- Clean up the filename (remove whitespace, brackets, etc.)&lt;br /&gt;
        imageName = mw.text.trim(imageName)&lt;br /&gt;
        return imageName&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Fallback: try to find any file link in the infobox&lt;br /&gt;
    local fallbackPattern = &amp;quot;%[%[File:([^%]]+).?%]%]&amp;quot;&lt;br /&gt;
    local fallbackName = string.match(content, fallbackPattern)&lt;br /&gt;
    &lt;br /&gt;
    if fallbackName then&lt;br /&gt;
        return mw.text.trim(fallbackName)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- If all else fails, return empty string (DPL will skip this entry)&lt;br /&gt;
    return &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Ais</name></author>
	</entry>
</feed>