Modulo:mchkparametrojn: Malsamoj inter versioj
Enhavo forigita Enhavo aldonita
update |
Nuligis version 695569 de Taylor 49 (Diskuto | kontribuoj) Etikedo: Malfaro |
||
Linio 3:
MODULE "mchkparametrojn" (check parametrojn)
"eo.wiktionary.org/wiki/Modulo:mchkparametrojn"
Benefit: performs 2 comparisons in order to check validity
Linio 23:
the lower limit, and less than 64)
- optional "E" string to allow empty parameters
Returned: - string "1" if the parameters are
the parameters supplied to the caller are
module itself
Note that with both WIKI and LUA empty strings and parameters are valid
Linio 31:
however empty parameters are rarely useful, therefore the default
behavior is to disallow them.
Cannot be used to ensure that ZERO parameters have been submitted,
Linio 43 ⟶ 38:
sed tio estas farebla per simpla "#if"-ordono:
▲#protekto-->{{#if:<!--o-->{{{1|}}}<!--o-->|<!--then-->{{er
▲aroplendu|contoh}}<!--o-->[[Kategorio:Erara uzo de con
▲toh]]<!--o-->|<!--else--><!--protekto#
#protekto-->}}<!--endif--><!--protekto#▼
#protekto-->{{#if:<!--o-->{{{1|}}}<!--o-->|<!--th▼
This module is unbreakable (when called with correct module name
Linio 72 ⟶ 56:
"{{#invoke:mchkparametrojn|ek|0|1}}"
▲rojn|ek|1|2}}<!--o-->|<!--equal-->1<!--o-->|<!--then--><!--protekto#
]===]
local chkparametrojn = {}
function chkparametrojn.ek (frame)
local strtmp = "" ; -- temp for decimal conversion
local strret = "0" ; -- output string
Linio 96 ⟶ 73:
local numiter = 0 ; -- index iterating through parameters of the caller
local booemp = false ; -- flag allow empty parameters (default is disallow)
if ((frame.args [1]) and (frame.args [2])) then
strtmp = frame.args [1] ; -- lower limit (1 digit)
numlong =
if (numlong==1) then
numlowl =
numlowl = 255 ; -- 255 is invalid, note that ZERO would be valid
end--if▼
end--if
strtmp = frame.args [2] ; -- upper limit (1 or 2 digits)
numlong =
if ((numlong==1) or (numlong==2)) then
numuppl =
numuppl = 255 ; -- 255 is invalid, note that ZERO would be valid
end--if
end--if
if (numlong==2) then
numuppm =
numuppl = 255 ; -- 255 is invalid, note that ZERO would be valid
else
Linio 125 ⟶ 104:
end--if
end--if
if ((numlowl<10) and (numuppl>=1) and (numuppl>=numlowl) and (numuppl<64)) then
while (true) do -- iterate through parameters of the caller
Linio 142 ⟶ 120:
end--if
end--if
return strret
end--function
▲ end--if
return chkparametrojn
|