Module:Infobox ET: Difference between revisions

Strange things happen
I guess I'll use this function to do the trick
Line 6: Line 6:
local ET = require('Module:ET')
local ET = require('Module:ET')
local infobox = require('Module:Infobox')
local infobox = require('Module:Infobox')
-- check whether the input is a non-empty string
local function value_provided(s)
return type(s) == 'string' and #s > 0
end


-- towards is one of: -1 (floor), 0 (nearest), 1 (ceil)
-- towards is one of: -1 (floor), 0 (nearest), 1 (ceil)
Line 70: Line 75:
local zeta_override = frame.args['Zeta']
local zeta_override = frame.args['Zeta']
local zeta_switch = nil
local zeta_switch = nil
if type(zeta_override) == 'string' and #zeta_override > 0 then
if value_provided(zeta_override) then
zeta_switch = not zeta_override:match('^[Nn][Oo]$')
zeta_switch = not zeta_override:match('^[Nn][Oo]$')
else
else
Line 185: Line 190:
if zeta_switch then
if zeta_switch then
if #text > 0 then text = text .. '<br>' end
if #text > 0 then text = text .. '<br>' end
if not (type(zeta_override) == 'string' and #zeta_override > 0) then
if not value_provided(zeta_override) then
text = text .. ET.why_zeta(et)
text = text .. ET.why_zeta(et)
else
else
Line 204: Line 209:
next_one
next_one
)
)
if not debug_mode then
if not value_provided(debug_mode) then
result = result .. categories
result = result .. categories
end
end