Modulis:Lapas ID
Lua kļūda Modulis:Documentation, 144. rinda: message: type error in message cfg.container (string expected, got nil).
local p = {}
function p.main(frame)
local out = {}
for k,v in ipairs(frame.args) do
local id = tonumber(v)
if not id then
error(string.format("Nederīgs lapas ID %s", v))
end
local title = mw.title.new(id)
if title then
out[k] = string.format("* %d: %s\n", title.id, title.prefixedText)
else
out[k] = string.format("* Nav lapas ar šādu ID %d\n", id)
end
end
return table.concat(out)
end
function p.main2(frame)
local out = {}
for k,v in ipairs(frame.args) do
local id = tonumber(v)
if not id then
error(string.format("Nederīgs lapas ID %s", v))
end
local title = mw.title.new(id)
if title then
out[k] = string.format("%s\n", title.prefixedText)
else
out[k] = string.format("* Nav lapas ar šādu ID %d\n", id)
end
end
return table.concat(out)
end
return p