Module:File link: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
don't include the library name in checkSelf method names
(rename the image table to a fileLink table, seeing as this code is applicable to all file links)
(don't include the library name in checkSelf method names)
Line 23:
function data:name(s)
checkSelf(self, 'fileLink:name')
checkType('fileLink:name', 1, s, 'string')
data.theName = s
Line 30:
function data:format(s, filename)
checkSelf(self, 'fileLink:format')
checkType('fileLink:format', 1, s, 'string', true)
checkType('fileLink:format', 2, format, 'string', true)
Line 62:
function data:width(px)
checkSelf(self, 'fileLink:width')
checkType('fileLink:width', 1, px, 'number', true)
if px and data.isUpright then
Line 72:
function data:height(px)
checkSelf(self, 'fileLink:height')
checkType('fileLink:height', 1, px, 'number', true)
if px and data.isUpright then
Line 82:
function data:upright(isUpright, factor)
checkSelf(self, 'fileLink:upright')
checkType('fileLink:upright', 1, isUpright, 'boolean', true)
checkType('fileLink:upright', 2, factor, 'number', true)
Line 94:
function data:resetSize()
checkSelf(self, 'fileLink:resetSize')
for i, field in ipairs{'theWidth', 'theHeight', 'isUpright', 'uprightFactor'} do
data[field] = nil
Line 102:
function data:location(s)
checkSelf(self, 'fileLink:location')
checkType('fileLink:location', 1, s, 'string', true)
local validLocations = {
Line 122:
function data:alignment(s)
checkSelf(self, 'fileLink:alignment')
checkType('fileLink:alignment', 1, s, 'string', true)
local validAlignments = {
Line 146:
function data:border(hasBorder)
checkSelf(self, 'fileLink:border')
checkType('fileLink:border', 1, hasBorder, 'boolean', true)
data.hasBorder = hasBorder
Line 153:
function data:link(s)
checkSelf(self, 'fileLink:link')
checkType('fileLink:link', 1, s, 'string', true)
data.theLink = s
Line 160:
function data:alt(s)
checkSelf(self, 'fileLink:alt')
checkType('fileLink:alt', 1, s, 'string', true)
data.theAlt = s
Line 167:
function data:page(num)
checkSelf(self, 'fileLink:page')
checkType('fileLink:page', 1, num, 'number', true)
data.thePage = s
Line 174:
function data:class(s)
checkSelf(self, 'fileLink:class')
checkType('fileLink:class', 1, s, 'string', true)
data.theClass = s
Line 181:
function data:lang(s)
checkSelf(self, 'fileLink:lang')
checkType('fileLink:lang', 1, s, 'string', true)
data.theLang = s
Line 188:
function data:caption(s)
checkSelf(self, 'fileLink:caption')
checkType('fileLink:caption', 1, s, 'string', true)
data.theCaption = s
Line 195:
function data:render()
checkSelf(self, 'fileLink:render')
local ret = {}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu