Module:File/doc: Difference between revisions
From Neodyland Wiki
More actions
m updated documentation |
m umm |
||
| Line 20: | Line 20: | ||
local exists = file.metadata().exists | local exists = file.metadata().exists | ||
if exists then | if exists then | ||
mw.log( | mw.log( file.metadata().width ) | ||
end | end | ||
</source> | </source> | ||
Revision as of 15:31, 10 February 2015
Scope
File title and file information. If the code here grows beyond a border line, this should be converted to an interface and the processing code should be outsourced.
Usage
From Wikitext
Search (Template:Key press) for @exports.
- Examples:
{{#invoke:File|extension|file=File:Test.jpg}}→jpg{{#invoke:File|width|file=File:Test.jpg}}→3120{{#invoke:File|dateWorkCreated|file=File:Ballot-sprite.png}}→{{#invoke:File|fileExists|file=File:Ballot-sprite.png}}→true
From Lua
local file = require( 'Module:File' )
local fileObj = file.File( 'Foo.bar.svg' )
local withoutExtension = fileObj.woExtension()
-- withoutExtension is now 'Foo.bar'
local exists = file.metadata().exists
if exists then
mw.log( file.metadata().width )
end