Home
Random
Log in
Settings
About Brighter Shores Wiki
Disclaimers
Search
Editing
Module:Location Table
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
require('strict') local parse = require('Module:Param Parse') local edit = 'Unknown <span class="small plainlinks">' .. require('Module:Edit button')() .. '</span>' local p = {} function p.main(frame) return p._main(frame:getParent().args) end function p._main(args) local tbl = mw.html.create('table') :addClass('wikitable sortable filterable sticky-header loctable autosort=1,a') :css{ ['text-align'] = 'center' } :tag('tr') :tag('th'):wikitext('Location'):done() :tag('th'):wikitext('Episode'):done() :tag('th'):wikitext('Qty.'):done() :done() local loc_version = args.version local location_object = mw.title.getCurrentTitle().fullText local id_prefix = 'LOC_' if loc_version then location_object = location_object .. '#' .. loc_version id_prefix = id_prefix .. loc_version .. '_' end local loc_json = {} for i = 1, 9007199254740992 do local loc = args['loc'..i] if not loc then break end local qty = args['qty'..i] qty = tonumber(qty or '') loc_json[loc] = qty or -1 local loc_link = ('[[%s]]'):format(loc) local episode = mw.smw.ask{loc_link, '?Episode#=', 'mainlabel=-'} episode = episode and episode[1][1] local id = id_prefix .. loc tbl:tag('tr') :attr{ id = id } :tag('td'):wikitext(loc_link) :tag('td'):wikitext(parse.episode_func(episode)):done() :tag('td'):wikitext(qty or edit):done() :done() mw.smw.subobject({ ['Location object'] = location_object, ['Located in'] = loc, ['Location quantity'] = qty or 'Unknown' }, id) end if loc_version then mw.smw.subobject({ ['Location JSON'] = mw.text.jsonEncode(loc_json) }, loc_version) else mw.smw.set{ ['Location JSON'] = mw.text.jsonEncode(loc_json) } end return tbl end return p
Summary:
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Brighter Shores:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Templates used on this page:
Template:Documentation
(
edit
)
Template:Extension DPL
(
edit
)
Template:T
(
edit
)
Module:Array
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:Location Table
(
edit
)
Module:Location Table/doc
(
edit
)
Module:Paramtest
(
edit
)
Module:T
(
edit
)
Module:Tooltip
(
edit
)
Module:Yesno
(
view source
) (semi-protected)
This page is a member of a hidden category:
Category:Pages using DynamicPageList3 parser function