<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.you107657.duckdns.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ASmithingUsage</id>
	<title>Module:SmithingUsage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.you107657.duckdns.org/index.php?action=history&amp;feed=atom&amp;title=Module%3ASmithingUsage"/>
	<link rel="alternate" type="text/html" href="https://wiki.you107657.duckdns.org/index.php?title=Module:SmithingUsage&amp;action=history"/>
	<updated>2026-09-27T02:32:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.you107657.duckdns.org/index.php?title=Module:SmithingUsage&amp;diff=13223&amp;oldid=prev</id>
		<title>imported&gt;Merge: merge.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.you107657.duckdns.org/index.php?title=Module:SmithingUsage&amp;diff=13223&amp;oldid=prev"/>
		<updated>2026-09-25T10:55:52Z</updated>

		<summary type="html">&lt;p&gt;merge.py&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:55, 25 September 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key tensura:diff:1.41:old-5406:rev-13223 --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Merge</name></author>
	</entry>
	<entry>
		<id>https://wiki.you107657.duckdns.org/index.php?title=Module:SmithingUsage&amp;diff=5406&amp;oldid=prev</id>
		<title>imported&gt;Merge: merge.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.you107657.duckdns.org/index.php?title=Module:SmithingUsage&amp;diff=5406&amp;oldid=prev"/>
		<updated>2026-09-25T10:55:52Z</updated>

		<summary type="html">&lt;p&gt;merge.py&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local cargo = require(&amp;quot;mw.ext.cargo&amp;quot;)&lt;br /&gt;
local ui = require(&amp;quot;Module:UI&amp;quot;) -- Your module containing the `smithing` function&lt;br /&gt;
&lt;br /&gt;
local p = {} -- Define the module&amp;#039;s namespace&lt;br /&gt;
&lt;br /&gt;
local function escapeString(str)&lt;br /&gt;
    return mw.text.jsonEncode(str):sub(2, -2) -- Escapes special characters&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.smithingUsage(frame)&lt;br /&gt;
    local args = frame:getParent().args&lt;br /&gt;
    local itemName = args[&amp;quot;item&amp;quot;] or mw.title.getCurrentTitle().text&lt;br /&gt;
&lt;br /&gt;
    -- Ensure itemName is a string and escape special characters&lt;br /&gt;
    if type(itemName) ~= &amp;quot;string&amp;quot; then&lt;br /&gt;
        return &amp;quot;Error: Invalid item name provided.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    itemName = escapeString(itemName)&lt;br /&gt;
&lt;br /&gt;
    -- Extract base item name (remove quantity if present)&lt;br /&gt;
    local baseItemName = itemName:match(&amp;quot;([^,]+)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    -- Construct the where clause as a string&lt;br /&gt;
    local whereClause = string.format(&lt;br /&gt;
        &amp;quot;Input1 LIKE &amp;#039;%%%s%%&amp;#039; OR Input2=&amp;#039;%s&amp;#039; OR Input3=&amp;#039;%s&amp;#039; OR Input4=&amp;#039;%s&amp;#039; OR Input5=&amp;#039;%s&amp;#039; OR OutputName=&amp;#039;%s&amp;#039;&amp;quot;,&lt;br /&gt;
        baseItemName, itemName, itemName, itemName, itemName, itemName&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
    -- Debugging: Log the whereClause&lt;br /&gt;
    mw.logObject(whereClause)&lt;br /&gt;
    mw.logObject(type(whereClause))&lt;br /&gt;
&lt;br /&gt;
    -- Query Cargo for smithing recipes involving the item&lt;br /&gt;
    local results = cargo.query({&lt;br /&gt;
        tables = &amp;quot;SmithingBenchRecipes&amp;quot;,&lt;br /&gt;
        fields = &amp;quot;Input1, Input2, Input3, Input4, Input5, OutputName&amp;quot;,&lt;br /&gt;
        where = whereClause,&lt;br /&gt;
        limit = 500 -- Reasonable limit for results&lt;br /&gt;
    })&lt;br /&gt;
&lt;br /&gt;
    -- No results found&lt;br /&gt;
    if #results == 0 then&lt;br /&gt;
        return &amp;quot;No smithing recipes found for this item.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Render each smithing recipe&lt;br /&gt;
    local out = {}&lt;br /&gt;
    for _, recipe in ipairs(results) do&lt;br /&gt;
        -- Prepare arguments for the smithing function&lt;br /&gt;
        local recipeArgs = {&lt;br /&gt;
            [&amp;quot;Input1&amp;quot;] = recipe.Input1,&lt;br /&gt;
            [&amp;quot;Input2&amp;quot;] = recipe.Input2,&lt;br /&gt;
            [&amp;quot;Input3&amp;quot;] = recipe.Input3,&lt;br /&gt;
            [&amp;quot;Input4&amp;quot;] = recipe.Input4,&lt;br /&gt;
            [&amp;quot;Input5&amp;quot;] = recipe.Input5,&lt;br /&gt;
            [&amp;quot;Output&amp;quot;] = recipe.OutputName&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        -- Call the smithing function and append its output&lt;br /&gt;
        table.insert(out, ui.smithing(recipeArgs))&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Return the combined HTML&lt;br /&gt;
    return table.concat(out, &amp;quot;\n&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p -- Return the module&amp;#039;s namespace&lt;/div&gt;</summary>
		<author><name>imported&gt;Merge</name></author>
	</entry>
</feed>