To element: Difference between revisions
Jump to navigation
Jump to search
imported>Bale mNo edit summary |
imported>Eliteofdelete No edit summary |
||
Line 17: | Line 17: | ||
function_description=Returns the specified element {{pspan|name}} as an element.| | function_description=Returns the specified element {{pspan|name}} as an element.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=Following example shows basic to_element operations.|| | |||
code= | |||
<syntaxhighlight> | |||
foreach it in $strings[hot, colD, slime, SpookY, stench] | |||
print("The string -"+it+"- gives element: "+to_element(it), "blue"); | |||
</syntaxhighlight>| | |||
moreinfo= | |||
It gives the following output. | |||
<pre> | |||
The string -hot- gives element: hot | |||
The string -colD- gives element: none | |||
The string -slime- gives element: slime | |||
The string -SpookY- gives element: none | |||
The string -stench- gives element: stench | |||
</pre> | |||
}}| | |||
special=Note that this function is case-sensitive, as with direct casting. Anything besides the following list will return $element[ none ], including strings with extra or missing characters: cold, hot, sleaze, spooky, stench, slime.| | special=Note that this function is case-sensitive, as with direct casting. Anything besides the following list will return $element[ none ], including strings with extra or missing characters: cold, hot, sleaze, spooky, stench, slime.| |
Latest revision as of 14:44, 26 January 2015
Function Syntax
element to_element(string name )
- name is the element name to convert
Returns the specified element name as an element.
Code Samples
Following example shows basic to_element operations.
foreach it in $strings[hot, colD, slime, SpookY, stench]
print("The string -"+it+"- gives element: "+to_element(it), "blue");
It gives the following output.
The string -hot- gives element: hot The string -colD- gives element: none The string -slime- gives element: slime The string -SpookY- gives element: none The string -stench- gives element: stench
Special
Note that this function is case-sensitive, as with direct casting. Anything besides the following list will return $element[ none ], including strings with extra or missing characters: cold, hot, sleaze, spooky, stench, slime.