m (I forgot Lua indexes tables starting with 1) |
(Created page with "local p = {} local function uniqueIdToTitleId(uidstr) local uniqueId if type(uidstr) == 'number' then uniqueId = uidstr else -- check if it starts with 0x local start = string.sub(uidstr, 0, 2) if start == '0x' then uniqueId = tonumber(uidstr) else uniqueId = tonumber(uidstr, 16) end end -- maybe this should allow for stuff like choosing content category? return string.format('00040000%06x00', uniqueId) end function p.makeTitleId(frame) return...") |
||
Line 19: | Line 19: | ||
function p.makeTitleId(frame) | function p.makeTitleId(frame) | ||
return uniqueIdToTitleId(frame.args[ | return uniqueIdToTitleId(frame.args[0]) | ||
end | end | ||
return p | return p |
Revision as of 22:15, 15 December 2022
Documentation for this module may be created at Module:Title ID/doc
local p = {}
local function uniqueIdToTitleId(uidstr)
local uniqueId
if type(uidstr) == 'number' then
uniqueId = uidstr
else
-- check if it starts with 0x
local start = string.sub(uidstr, 0, 2)
if start == '0x' then
uniqueId = tonumber(uidstr)
else
uniqueId = tonumber(uidstr, 16)
end
end
-- maybe this should allow for stuff like choosing content category?
return string.format('00040000%06x00', uniqueId)
end
function p.makeTitleId(frame)
return uniqueIdToTitleId(frame.args[0])
end
return p