Module talk:Storm categories: Difference between revisions

Content deleted Content added
m Archiving 1 discussion(s) to Module talk:Storm categories/Archive 1) (bot
Line 13:
}}
__FORCETOC__
 
== Accidental short-circuit in ternary expressions at lines 51 and 73 ==
 
This module has a mistake at lines 51 and 73, in the instances of {{code|1=or (nullIfMissing and nil or [foo])|lang=lua}}; these lines attempt to output <code>nil</code> if <code>nullIfMissing</code> is truthy and otherwise <code>[foo]</code>, but because nil is falsy, the <code>or [foo]</code> will always trigger, and as such the expression simply short-circuits to <code>or [foo]</code>. {&#123;'''[[User:Lemondoge|Lemondoge]]'''&#124;[[User talk:Lemondoge|Talk]]&#124;[[Special:Contributions/Lemondoge|Contributions]]&#125;} 22:20, 12 April 2023 (UTC)
 
:{{re|Lemondoge}} Good catch; didn't notice that.
{{tper|answered=yes}}
:Line 51 to:
:<syntaxhighlight lang="lua" line start="51">
or (not nullIfMissing and error("No default name for basin-based category name.") or nil)
</syntaxhighlight>
:Line 73 to:
:<syntaxhighlight lang="lua" line start="73">
) or (not nullIfMissing and cats[defaultCategory].icon) or nil)
</syntaxhighlight>
:per the above. <span style="background:#ffff55">'''''[[User:Chlod|Chlod]]'''''</span>&nbsp;<small style="font-size:calc(1em - 2pt)">([[User talk:Chlod|say&nbsp;hi!]])</small> 22:48, 12 April 2023 (UTC)
 
::{{edited2}}. '''''[[User:Paine Ellsworth|<span style="font-size:92%;color:darkblue;font-family:Segoe Script">P.I.&nbsp;Ellsworth</span>]]'''''&thinsp;,&nbsp;[[Editor|<span style="color:black">ed.</span>]]&nbsp;[[User talk:Paine Ellsworth|<sup>put'er&nbsp;there</sup>]]&nbsp;<small>09:34, 13 April 2023 (UTC)</small>
:::Thank you! <span style="background:#ffff55">'''''[[User:Chlod|Chlod]]'''''</span>&nbsp;<small style="font-size:calc(1em - 2pt)">([[User talk:Chlod|say&nbsp;hi!]])</small> 09:35, 13 April 2023 (UTC)
::::''my pleasure!''&nbsp;'''''[[User:Paine Ellsworth|<span style="font-size:100%;color:darkblue;font-family:Segoe Script">Paine</span>]]'''''&nbsp;&nbsp;<small>09:37, 13 April 2023 (UTC)</small>
 
== Edit request 18 April 2023 ==