Modulo:mchkparametrojn: Malsamoj inter versioj

Enhavo forigita Enhavo aldonita
Taylor 49 (diskuto | kontribuoj)
revert
Taylor 49 (diskuto | kontribuoj)
fix
Linio 29:
local strret = "0" ; -- output string
local numlong = 0 ; -- temp for decimal conversion (length of parameter)
local numuppm = 2550 ; -- temp for decimal conversion (no need to preset)
local numuppl = 255 ; -- upper limit (preset to invalid)
local numlowl = 255 ; -- lower limit (preset to invalid)
local numiter = 0 ; -- index iterating through parameters of the caller
if ((frame.args [1]) and (frame.args [2])) then
strtmp = frame.args [1] ; -- lower limit (1 digit)
numlong = mw.ustring.len (strtmp) ; -- lengthtemp offor thedecimal input stringconversion
if (numlong==1) then
numlowl = mw.ustring.codepoint (strtmp,1,1) - 48 ; -- may be invalid
if ((numlowl<0) or (numlowl>9)) then
numlowl = 255 ; -- 255 is invalid, note that ZERO would be invalid too
end--if
end--if
strtmp = frame.args [2] ; -- upper limit (1 or 2 digits)
if ((numlowl<0) or (numlowl>9)) then
numlowl = 255 ; -- 255 is invalid, note that ZERO would be invalid too
end--if
strtmp = frame.args [2] ; -- upper limit
numlong = mw.ustring.len (strtmp) ; -- temp for decimal conversion
if ((numlong==1) or (numlong==2)) then
numuppl = mw.ustring.codepoint (strtmp,1,1) - 48 ; -- may be invalid
if ((numuppl<0) or (numuppl>9) or (numuppm<0) or (numuppm>9)) then
numuppl = 255 ; -- 255 is invalid, note that ZERO would be invalid too
end--if
end--if
if (numlong==2) then
numuppm = mw.ustring.codepoint (strtmp,2,2) - 48 ; -- may be invalid
if ((numuppm<0) or (numuppm>9)) then
end--if
numuppl = 255 ; -- 255 is invalid, note that ZERO would be invalid too
if ((numuppl<0) or (numuppl>9) or (numuppm<0) or (numuppm>9)) then
else
numuppl = 255 ; -- 255 is invalid, note that ZERO would be invalid too
else
if (numlong==2) then
numuppl = numuppl * 10 + numuppm ; -- valid integer number 0...99 now
end--if