Diamond Hunt Mobile Wiki
Advertisement

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

db = require("Module:Crafting_DB")

local p = {}

function p.used_in_table(name)
    recipes = {}
    for _, e in ipairs(db) do
        for _, f in ipairs(e[3]) do
            if f[1] == name then
                table.insert(recipes, {e[1], e[2], f[2]})
            end
        end
    end
    result = [[
{| class="article-table"
!Item
!Crafting level
!Amount needed
]]
    for _, e in ipairs(recipes) do
        result = result .. [[
|-
|]] .. '[[File: ' .. e[1]:gsub(' ', '') .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. e[2] .. [[

|]] .. e[3] .. [[

]]
    end
    return result .. [[
|}
]]
end

function p.tuit(frame)
    return p.used_in_table(frame.args[1] or frame:getParent():getTitle())
end

return p
Advertisement