Difference between revisions of "Template:LSL Conditional"

From Second Life Wiki
Jump to navigation Jump to search
(Noted caveat in boolean evaluation of LSO-compiled lists: BUG-230728)
 
(51 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL Header}} __NOTOC__ <noinclude>
{{multi-lang|category=LSL}}{{LSL Header{{#var:lang}}}} __NOTOC__ <noinclude>
<pre>
<pre>
{{LSL_Conditional
{{LSL_Conditional
Line 20: Line 20:
|p12_name|p12_desc
|p12_name|p12_desc
|constants
|constants
|spec
|caveats
|examples
|examples
|helpers
|helpers
Line 40: Line 38:


<div id="box">
<div id="box">
{{LSL_Conditional
{{{{FULLPAGENAME}}
|statement=funckyloop
|statement=funckyloop
|statement_desc=A fictitious statement type
|statement_desc=A fictitious statement type
Line 53: Line 51:
|p6_name=v|p6_desc=v
|p6_name=v|p6_desc=v
|p7_name=r|p7_desc=r
|p7_name=r|p7_desc=r
|constants=constants
|spec=spec
|spec=spec
|caveats=caveats
|caveats=caveats
Line 73: Line 70:
}}
}}
</div>
</div>
</noinclude><includeonly>{{LSL Generic
</noinclude><includeonly>{{#if:
|{{{statement}}}|
 
|header_floater
{{Footnote|handle=OpenSim|The OpenSim LSL compiler will not do this implicitly. You will need to use an explicit check.}}
|header_text={{LSL_Generic/Text
 
|header_desc={{{statement_type|}}}
{{#if:{{#var:history}}{{{history|}}}|
|header_footnote={{{statement_desc|}}}
{{#vardefine:history|{{#var:history}}{{PBR}}
|pe_name={{{statement_end|}}}|pe_desc={{{statement_end_desc|}}}
{{{history|}}}{{PBR}}}}
|p1_name={{{p1_name|}}}|p1_desc={{{p1_desc|}}}
}}
|p2_name={{{p2_name|}}}|p2_desc={{{p2_desc|}}}
 
|p3_name={{{p3_name|}}}|p3_desc={{{p3_desc|}}}
{{#if:{{#var:deepnotes}}{{{deepnotes|}}}|
|p4_name={{{p4_name|}}}|p4_desc={{{p4_desc|}}}
{{#vardefine:deepnotes|{{#var:deepnotes}}{{PBR}}
|p5_name={{{p5_name|}}}|p5_desc={{{p5_desc|}}}
{{{deepnotes|}}}{{PBR}}}}
|p6_name={{{p6_name|}}}|p6_desc={{{p6_desc|}}}
}}
|p7_name={{{p7_name|}}}|p7_desc={{{p7_desc|}}}
 
|p8_name={{{p8_name|}}}|p8_desc={{{p8_desc|}}}
{{#if:{{#var:mono}}{{{mono|}}}|
|p9_name={{{p9_name|}}}|p9_desc={{{p9_desc|}}}
{{#vardefine:mono|{{#var:mono}}{{PBR}}
|p10_name={{{p10_name|}}}|p10_desc={{{p10_desc|}}}
{{{mono|}}}{{PBR}}}}
|p11_name={{{p11_name|}}}|p11_desc={{{p11_desc|}}}
}}
|p12_name={{{p12_name|}}}|p12_desc={{{p12_desc|}}}}}
 
|header_title={{LSL_Generic/Title
{{#if:{{#var:lso}}{{{lso|}}}|
|name={{{statement}}}
{{#vardefine:lso|{{#var:lso}}{{PBR}}
|template=none
{{{lso|}}}{{PBR}}}}
|return_end=&nbsp;{{{statement_end|}}}
}}
|p1_name={{{p1_name|}}}|p2_name={{{p2_name|}}}
 
|p3_name={{{p3_name|}}}|p4_name={{{p4_name|}}}
{{#vardefine:issues|{{#var:issues}}
|p5_name={{{p5_name|}}}|p6_name={{{p6_name|}}}
{{{issues|}}}}}
|p7_name={{{p7_name|}}}|p8_name={{{p8_name|}}}
 
|p9_name={{{p9_name|}}}|p10_name={{{p10_name|}}}
{{#vardefine:also_tests|{{#var:also_tests}}
|p11_name={{{p11_name|}}}|p12_name={{{p12_name|}}}}}
{{{also_tests|}}}}}
|deprecated={{{deprecated|}}}
 
|constants={{{constants|}}}
{{#if:{{#var:location}}{{{location|}}}|
|spec={{{spec|}}}
{{#vardefine:location|{{#var:location}}{{PBR}}
|caveats={{{caveats|}}}
{{{location|}}}{{PBR}}}}
|examples={{{examples|}}}
}}
|helpers={{{helpers|}}}
 
|also_header={{{also_header|}}}
{{#if:{{#var:messaging}}{{{messaging|}}}|
|also_events={{{also_events|}}}
{{#vardefine:messaging|{{#var:messaging}}{{PBR}}
|also_functions={{{also_functions|}}}
{{{messaging|}}}{{PBR}}}}
|also_tests={{{also_tests|}}}
}}
|also_articles={{{also_articles|}}}
 
|also_footer={{{also_footer|}}}
}}{{#vardefine:pe_name|{{{statement_end|}}}}}{{#vardefine:pe_desc|{{#var:p_{{#var:pe_name}}_desc}}{{{statement_end_desc|}}}}}{{#vardefine:p1_name|{{{p1_name|}}}}}{{#vardefine:p1_type|{{{p1_type|}}}}}{{#vardefine:p_{{#var:p1_name}}_desc|{{#var:p_{{#var:p1_name}}_desc}}{{{p1_desc|}}}}}{{#vardefine:p2_name|{{{p2_name|}}}}}{{#vardefine:p2_type|{{{p2_type|}}}}}{{#vardefine:p_{{#var:p2_name}}_desc|{{#var:p_{{#var:p2_name}}_desc}}{{{p2_desc|}}}}}{{#vardefine:p3_name|{{{p3_name|}}}}}{{#vardefine:p3_type|{{{p3_type|}}}}}{{#vardefine:p_{{#var:p3_name}}_desc|{{#var:p_{{#var:p3_name}}_desc}}{{{p3_desc|}}}}}{{#vardefine:p4_name|{{{p4_name|}}}}}{{#vardefine:p4_type|{{{p4_type|}}}}}{{#vardefine:p_{{#var:p4_name}}_desc|{{#var:p_{{#var:p4_name}}_desc}}{{{p4_desc|}}}}}{{#vardefine:p5_name|{{{p5_name|}}}}}{{#vardefine:p5_type|{{{p5_type|}}}}}{{#vardefine:p_{{#var:p5_name}}_desc|{{#var:p_{{#var:p5_name}}_desc}}{{{p5_desc|}}}}}{{#vardefine:p6_name|{{{p6_name|}}}}}{{#vardefine:p6_type|{{{p6_type|}}}}}{{#vardefine:p_{{#var:p6_name}}_desc|{{#var:p_{{#var:p6_name}}_desc}}{{{p6_desc|}}}}}{{#vardefine:p7_name|{{{p7_name|}}}}}{{#vardefine:p7_type|{{{p7_type|}}}}}{{#vardefine:p_{{#var:p7_name}}_desc|{{#var:p_{{#var:p7_name}}_desc}}{{{p7_desc|}}}}}{{#vardefine:p8_name|{{{p8_name|}}}}}{{#vardefine:p8_type|{{{p8_type|}}}}}{{#vardefine:p_{{#var:p8_name}}_desc|{{#var:p_{{#var:p8_name}}_desc}}{{{p8_desc|}}}}}{{#vardefine:p9_name|{{{p9_name|}}}}}{{#vardefine:p9_type|{{{p9_type|}}}}}{{#vardefine:p_{{#var:p9_name}}_desc|{{#var:p_{{#var:p9_name}}_desc}}{{{p9_desc|}}}}}{{#vardefine:p10_name|{{{p10_name|}}}}}{{#vardefine:p10_type|{{{p10_type|}}}}}{{#vardefine:p_{{#var:p10_name}}_desc|{{#var:p_{{#var:p10_name}}_desc}}{{{p10_desc|}}}}}{{#vardefine:p11_name|{{{p11_name|}}}}}{{#vardefine:p11_type|{{{p11_type|}}}}}{{#vardefine:p_{{#var:p11_name}}_desc|{{#var:p_{{#var:p11_name}}_desc}}{{{p11_desc|}}}}}{{#vardefine:p12_name|{{{p12_name|}}}}}{{#vardefine:p12_type|{{{p12_type|}}}}}{{#vardefine:p_{{#var:p12_name}}_desc|{{#var:p_{{#var:p12_name}}_desc}}{{{p12_desc|}}}}}{{#vardefine:return_end|&nbsp;{{#if:{{#var:pe_desc}}|{{HoverText|{{#var:pe_name}}|{{#var:pe_desc}}}}|{{#var:pe_name}}}}}}{{#vardefine:name|{{{statement}}}}}{{#vardefine:type|flow control}}{{#vardefine:template|none}}{{#ifeq:{{#var:mode}}|god|{{{{#ifeq:{{#var:mode}}|god|LSL_Generic/god|!}}|}} }}{{#ifeq:{{#var:mode}}|request|{{{{#ifeq:{{#var:mode}}|request|LSL_Generic/request|!}}|}} }}{{#if:{{{deprecated|}}}{{{depreciated|}}}|{{{{#if:{{{deprecated|}}}{{{depreciated|}}}|LSL_Generic/deprecated|!}}|{{{deprecated|}}}{{{depreciated|}}}|}}}}{{#vardefine:mode|{{#var:mode}}{{{mode|}}}}}{{#vardefine:self|{{#var:self}}{{{self|}}}}}{{#vardefine:sort|{{#if:{{#var:sort}}|{{#var:sort}}|{{#if:{{{sort|}}}|{{{sort}}}|{{ucfirst:{{#var:name}}}}}}}}}}{{#vardefine:header_footnote|{{{statement_desc|}}}}}{{#vardefine:header_desc|{{{statement_type|}}}}}{{#vardefine:separator|<nowiki>;</nowiki>}}{{#vardefine:header_text|{{LSL_Generic/Text}}}}{{#vardefine:header_title|{{#if:{{{statement_title|}}}|{{{statement_title|}}}|{{LSL_Generic/Title}}}}}}{{#ifeq:{{NAMESPACE}}|Template|<div></div>|<div id="RealTitleBanner" style="display:none;"><span id="RealTitle">{{#var:name}}</span></div>}} __NOTOC__ {{#if:{{#var:self}}|| __NOEDITSECTION__ }} {{#var:header}}
|notes={{{notes|}}}
<div id="box">
|mode={{{mode|}}}
<h2>{{#var:header_title}}</h2>
|self={{{self|}}}
<div style="padding: 0.5em">
|type=event
{{#var:header_text}}
|template=LSLG
</div></div>
|footer={{#if: {{{no_footer|}}}||:<div style="font-size:x-small;">This page is based on information gathered from the Second Life client {{HoverText|source|'linden\indra\newview\app_settings\keywords.ini'}}, and as such has additional [http://secondlife.com/developers/opensource/licenses licensing restrictions].</div>}}
{{#var:extras}}{{{extras|}}}<div id="box">
}}{{#if:{{{self|}}}|| {{#ifeq:{{{mode|}}}|request||{{LSLC|Flow Control|{{{statement|}}}}}}} {{#if:{{{cat1|}}}|{{LSLC|{{{cat1}}}|{{{statement|}}}}}}} {{#if:{{{cat2|}}}|{{LSLC|{{{cat2}}}|{{{statement|}}}}}}} {{#if:{{{cat3|}}}|{{LSLC|{{{cat3}}}|{{{statement|}}}}}}} {{#if:{{{cat4|}}}|{{LSLC|{{{cat4}}}|{{{statement|}}}}}}}}}</includeonly>
<h2>Specification</h2>
<div style="padding: 0.5em">
<!--LSL_Constants_Conditional - BEGIN-->
<div style="float:left;">
{{{!}} {{Prettytable}}
{{!}}+ '''Conditional Types'''
{{!}}-{{Hl2}}
!Type
!Condition
{{!}}-
{{!}}[[integer]]
{{!}}True if it is not zero.
{{!}}-
{{!}}[[float]]
{{!}}True if it is not zero.{{Footnote|handle=OpenSim}}
{{!}}-
{{!}}[[string]]
{{!}}True if its [[llStringLength|length]] is not zero.
{{!}}-
{{!}}[[key]]
{{!}}True only if it is a valid key and not [[NULL_KEY]].
{{!}}-
{{!}}[[vector]]
{{!}}True if the vector is not [[ZERO_VECTOR]].
{{!}}-
{{!}}[[rotation]]
{{!}}True if the rotation is not [[ZERO_ROTATION]].
{{!}}-
{{!}}[[list]]
{{!}}True if the [[llGetListLength|length]] is not zero.  Note that correct behavior is only seen with Mono-compiled scripts; LSO-compiled scripts incorrectly resolve to [[false]] if the list is non-empty: BUG-230728
{{!}}}
</div>
<!--LSL_Constants_Conditional - END-->
{{#var:spec}}{{PBR}}
{{{spec|}}}{{PBR}}
<div style="clear:left;"></div></div></div>{{#if:{{#if:{{#var:deprecated}}||t}}{{#var:examples}}{{{examples|}}}|
<div id="box"><h2>{{#if:{{#var:T_Examples}}|{{#var:T_Examples}}|Examples}}</h2>
<div style="padding: 0.5em">
{{#var:examples}}{{{examples|}}}
</div></div>}}{{#if:{{#var:notes}}{{{notes|}}}|
<div id="box"><h2>Notes</h2>
<div style="padding: 0.5em">
{{#var:notes}}{{{notes|}}}
<br style="clear:left;"></div></div>}}{{#if:{{#var:helpers}}{{{helpers|}}}|
<div id="box"><h2>Useful Snippets</h2>
<div style="padding: 0.5em">
{{#var:helpers}}{{{helpers|}}}
</div></div>}}{{#if:{{#var:also_footer}}{{{also_footer|}}}{{#var:also_functions}}{{{also_functions|}}}{{#var:also_events}}{{{also_events|}}}{{#var:also_articles}}{{{also_articles|}}}{{#var:also_tests}}{{{also_tests|}}}{{#var:also_header}}{{{also_header|}}}|
<div id="box"><h2>See Also</h2>
<div style="padding: 0.5em">
{{#if:{{#var:also_header}}{{{also_header|}}}|
{{#var:also_header}}{{{also_header|}}}}}{{#if:{{#var:also_events}}{{{also_events|}}}|
<h3>Events</h3>
{{{!}}
{{#var:also_events}}
{{{also_events|}}}
{{!}}} }}{{#if:{{#var:also_functions}}{{{also_functions|}}}|
<h3>Functions</h3>
{{{!}}
{{#var:also_functions}}
{{{also_functions|}}}
{{!}}} }}{{#if:{{#var:also_tests}}{{{also_tests|}}}|
<h3>Tests</h3>
{{{!}}
{{#var:also_tests}}
{{{also_tests|}}}
{{!}}} }}{{#if:{{#var:also_articles}}{{{also_articles|}}}|
<h3>Articles</h3>
{{{!}}
{{#var:also_articles}}
{{{also_articles|}}}
{{!}}} }}
{{#if:{{#var:also_footer}}{{{also_footer|}}}|<br/>{{#var:also_footer}}{{{also_footer|}}}}}
</div></div>}}{{#if:{{#var:deepnotes}}{{#var:mono}}{{#var:lso}}{{#var:history}}{{#var:also_tests}}{{#var:issues{{#var:direction}}}}{{#var:location}}{{#var:messaging}}{{#var:footnotes}}{{#if:{{#pos:{{#var:moded}}|u}}||1}}{{{signature|}}}{{{haiku|}}}{{{poetry|}}}|<div id="box">
== Deep Notes ==
<div style="padding: 0.5em"><div>
{{#var:deepnotes}}
</div>{{#if:{{#var:mono}}|
<h4> Mono VM Notes </h4><div>
{{#var:mono}}
</div>}}{{#if:{{#var:lso}}|
<h4> LSO VM Notes </h4><div>
{{#var:lso}}
</div>}}{{#if:{{#var:history}}|
<h4> History </h4><div>
{{#var:history}}
</div>}}
{{Anchor|Issues}}{{LSL_Generic/Issues}}{{#if:{{#var:also_tests}}|
<h3>Tests</h3>
{{{!}}
{{#var:also_tests}}
{{!}}}
}}{{#if:{{#var:location}}|
<h4> Source </h4><div>
{{#var:location}}
</div>}}{{#if:{{#var:messaging}}|
<h4> Messaging </h4><div>
{{#var:messaging}}
</div>}}{{#if:{{#var:footnotes}}|
<h4 style="margin-bottom:0;"> Footnotes </h4>
{{{{#if:{{#var:footnotes}}|Footnotes|!}}|}}
}}
{{#if:{{{haiku|}}}{{{poetry|}}}|{{Collapsible_Table|table-class=haiku|table-style=width:100%;|title-style=text-align:left;|title=<h4 style="margin-top:0;">Haiku</h4>|content={{!}}
{{{haiku|}}}
{{{poetry|}}}
}}}}
</div></div>}}{{#if:{{{comments|}}}|<div id="box">
<h2>Comments</h2>
<div style="padding: 0.5em;">
{{{comments|}}}
</div></div>}}
<div style="display:none" class="hidden-text" id="hidden-text">{{#var:hidden-text}}</div>
{{#var:footer}}<span id="sort" style="display:none;">{{#var:sort}}</span>{{#if:{{{self|}}}|| {{#ifeq:{{#var:mode}}|request||{{LSLC|Flow Control{{#var:lang}}|{{#var:sort}}}}}} {{#if:{{#var:examples}}{{{examples|}}}||{{LSLC|Needs Example|{{#var:sort}}|{{#var:lang}}}}}} {{#if:{{{cat1|}}}|{{LSLC|{{{cat1}}}|{{#var:sort}}}}}} {{#if:{{{cat2|}}}|{{LSLC|{{{cat2}}}|{{#var:sort}}}}}} {{#if:{{{cat3|}}}|{{LSLC|{{{cat3}}}|{{#var:sort}}}}}} {{#if:{{{cat4|}}}|{{LSLC|{{{cat4}}}|{{#var:sort}}}}}} {{#if:{{{cat5|}}}|{{LSLC|{{{cat5}}}|{{#var:sort}}}}}} {{#if:{{{cat6|}}}|{{LSLC|{{{cat6}}}|{{#var:sort}}}}}} }}</includeonly>

Latest revision as of 09:36, 11 May 2021

{{LSL_Conditional
|statement
|statement_header
|statement_desc
|statement_end
|statement_end_desc
|p1_name|p1_desc
|p2_name|p2_desc
|p3_name|p3_desc
|p4_name|p4_desc
|p5_name|p5_desc
|p6_name|p6_desc
|p7_name|p7_desc
|p8_name|p8_desc
|p9_name|p9_desc
|p10_name|p10_desc
|p11_name|p11_desc
|p12_name|p12_desc
|constants
|examples
|helpers
|also_header
|also_functions
|also_tests
|also_articles
|also_footer
|notes
|mode
|deprecated
|cat1
|cat2
|cat3
|cat4
}}

funckyloop( i; f; s; k; l; v; rstatement_end

statement_type

•  i i
•  f f
•  s s
•  k k
•  l l
•  v v
•  r r
•  statement_end statement_end_desc


A fictitious statement type

Specification

Conditional Types
Type Condition
integer True if it is not zero.
float True if it is not zero.[1]
string True if its length is not zero.
key True only if it is a valid key and not NULL_KEY.
vector True if the vector is not ZERO_VECTOR.
rotation True if the rotation is not ZERO_ROTATION.
list True if the length is not zero. Note that correct behavior is only seen with Mono-compiled scripts; LSO-compiled scripts incorrectly resolve to false if the list is non-empty: BUG-230728

spec

Examples

examples

Notes

notes


Useful Snippets

helpers

See Also

also_header

Events

  • also_events

Functions

  • also_functions

Tests

  • also_tests
  • also_tests

Articles

  • also_articles


also_footer

Deep Notes

Search JIRA for related Issues

Tests

  • also_tests

Footnotes

  1. ^ The OpenSim LSL compiler will not do this implicitly. You will need to use an explicit check.