Trying to get rid of this error.; all Mediawiki is completely updated to
1.24.1: no wiki issues; Just Lua: i tried to download the newest Modules
from Wikipedia since I use most of my templates from there; Still
cropping up as below
Any Tips please;
Lua error in Module:In_the_news/image at line 19: attempt to index field
'file' (a nil value).
Backtrace:
1. *(tail call)*: ?
2. *Module:In_the_news/image:19
<http://beast.physicswiki.net/index.php?title=Module:In_the_news/image&action=edit#mw-ce-l19>*:
?
3. *(tail call)*: ?
4. *mw.lua:497*: ?
5. *(tail call)*: ?
6. *[C]*: in function "xpcall"
7. *MWServer.lua:87*: in function "handleCall"
8. *MWServer.lua:301*: in function "dispatch"
9. *MWServer.lua:40*: in function "execute"
10. *mw_main.lua:7*: in main chunk
11. *[C]*: ?
Below is the source of actual module in question:Line 19 is highlighted in red:
-- This module implements [[Template:In the news/image]], which displays
-- the news image on the Main Page.
local mFileLink = require('Module:File link')
local p = {}
function p._main(args)
if not args.image then
return nil
end
if not args.title then
error('no title specified', 2)
end
local imageTitle = mw.title.new(args.image, 6) -- NS_FILE
if not imageTitle then
error('invalid image title (check for bad characters): ' .. args.image, 2)
elseif not imageTitle.file.exists then
return string.format(
'<span class="error">No file exists at [[:%s]]</span>',
imageTitle.prefixedText
)
end
local link
if args.link then
local linkTitle = mw.title.new(args.link, 6) -- NS_FILE
if not linkTitle then
error('invalid link (check for bad characters): ' .. args.link, 2)
elseif linkTitle ~= imageTitle then
if not linkTitle.file.exists then
return string.format(
'<span class="error">No file exists at
[[:%s]]</span>',
linkTitle.prefixedText
)
end
link = linkTitle.prefixedText
end
end
return string.format(
'<div style="float:right;margin-left:0.5em;">\n%s</div>',
mFileLink._main{
file = imageTitle.text,
link = link,
size = args.size or '100x100px',
border = args.border,
caption = args.title,
alt = args.alt or args.title
}
)
end
function p.main(frame)
return p._main(require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:In the news/image'
}))
end
return p
--
John Foster
JW Foster & Associates