VOOZH about

URL: https://minecraft.wiki/w/Module:SpriteFile_List

⇱ Module:SpriteFile List – Minecraft Wiki


Module:SpriteFile List

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]Jump to code ↴

This module implements {{SpriteFile}} and {{SpriteFile List}}.

[view] [edit] [history] [purge]The above documentation is transcluded from Module:SpriteFile List/doc.
localp={}
functionp.file(f)
localtitle=mw.title.getCurrentTitle()
localname,id=title.text:match('^(%S+) (.+)%.')
localfile=(title.redirectTargetortitle).fullText
localdeprecated=f:getParent().args.deprecated~=nil
localcats=('[[Category:%s images]]'):format(name)
ifname=='Invicon'then-- [[Module:SpriteFile#L-45--L-47]]
name='InvSprite'
cats='[[Category:InvSprite files]]'
end
ifdeprecatedthen
cats=cats..'[[Category:Deprecated sprite names]]'
iff:callParserFunction('#dpl',{'',imageused=title.text,count=1})~=''then
cats=cats..'[[Category:In-use deprecated sprite names]]'
end
end
mw.ext.bucket('spritefile').put({
name=name,
id=id,
file=file,
deprecated=deprecated
})
returncats
end
localfunctioncontinuedBucketQuery(query)
locallimit=5000
localresult={}
localoffset=0
query.limit(limit)
whiletruedo
localresponse=query.run()
ifnotresponse[1]thenbreakend
for_,valueinipairs(response)do
table.insert(result,value)
end
offset=offset+limit
query.offset(offset)
end
returnresult
end
functionp.doc(f)
localargs=f:getParent().args
localbucket=continuedBucketQuery(mw.ext.bucket('spritefile')
.where('name',args.name)
.select('page_name','id','file','deprecated')
.orderBy('id','asc')
)
localids={}
localkeyedIds={}
for_,objectinipairs(bucket)do
ifnotkeyedIds[object.file]then
keyedIds[object.file]={}
table.insert(ids,keyedIds[object.file])
end
table.insert(keyedIds[object.file],object)
end
localheight=args.heightorargs.sizeor'16'
localwidth=args.widthorargs.sizeor'16'
localbody=mw.html.create('ul'):addClass('spritedoc-boxes')
for_,datainipairs(ids)do
localbox=body:tag('li'):addClass('spritedoc-box')
:tag('div'):addClass('spritedoc-image')
:wikitext(('[[%s|%sx%spx|class=pixel-image]]'):format(data[1].file,width,height))
:done()
:tag('ul'):addClass('spritedoc-names')
for_,idinipairs(data)do
box:tag('li'):addClass('spritedoc-name'):tag('code')
:wikitext(('[%s %s]'):format(
tostring(mw.uri.fullUrl(id.page_name,{redirect='no'})),
id.id
))
:addClass(id.deprecatedand'spritedoc-deprecated'ornil)
end
end
returnf:extensionTag{name='templatestyles',args={src='Sprite/doc.css'}}
..tostring(body)
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:SpriteFile_List?oldid=3321983"

Navigation menu