Module:Inventory slot
This module creates an inventory slot. {{Inventory slot}} should be preferred, rather than directly invoking this module on the article.
local p = {}
function p.createSlot( f )
local args = require( "Module:ProcessArgs" ).merge
local width = args.width or "32px"
local height = args.height or "32px"
local item = args.item
local link = args.link
local pageName = mw.title.getCurrentTitle().text
if item ~= nil then
mw.getCurrentFrame()
end
local slot = mw.html.create( "div" )
slot:css( "display", "inline-block" )
:css( "width", "32px" )
:css( "height", "32px" )
:css( "position", "relative" )
local slotContainer = mw.html.create( "div" )
slot:addClass( "inventory-slot" )
:addClass( "minecraft-item" )
:css( "position", "relative" )
:css( "width", width )
:css( "height", height )
:node( slot )
return slotContainer
end
function p.parseString(input)
local strings = {}
for str in input:gmatch("[^;]+") do
table.insert(strings, str:match("^%s*(.-)%s*$"))
end
local result = {}
for _, str in ipairs(strings) do
local name, item = str:match("^%[(.-)%](.*)$")
if name then
table.insert(result, { name = name:gsub("^%s*(.-)%s*$", "%1"), item = item:gsub("^%s*(.-)%s*$", "%1") })
else
table.insert(result, { name = str:gsub("^%s*(.-)%s*$", "%1"), item = str:gsub("^%s*(.-)%s*$", "%1") })
end
end
return result
end
return p