Module:Inventory slot/Aliases: Difference between revisions
m replaced spaces with tabs |
Add support for "Random" instead of "Any" |
||
Line 1: | Line 1: | ||
local p = { | |||
['Any fuel'] = 'Coal; Charcoal; Oak Wood; Oak Wood Planks', | ['Any fuel'] = 'Coal; Charcoal; Oak Wood; Oak Wood Planks', | ||
['Any Wood'] = 'Oak Wood; Spruce Wood; Birch Wood; Jungle Wood; Acacia Wood; Dark Oak Wood', | ['Any Wood'] = 'Oak Wood; Spruce Wood; Birch Wood; Jungle Wood; Acacia Wood; Dark Oak Wood', | ||
Line 36: | Line 36: | ||
['wait Disc'] = '[&bMusic Disc]wait Disc[&7C418 - wait]', | ['wait Disc'] = '[&bMusic Disc]wait Disc[&7C418 - wait]', | ||
} | } | ||
setmetatable(p, { | |||
__index = function(t, key) | |||
if key:match('^Random ') then | |||
local values = mw.text.split(t['Any '..key:sub(8)], '; ', true) | |||
return values[math.random(#values)] | |||
else | |||
return nil | |||
end | |||
end | |||
}) | |||
return p |