Difference between revisions of "To class"
Jump to navigation
Jump to search
imported>Bale m |
imported>Eliteofdelete |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
function1={{Function| | function1={{Function| | ||
+ | name={{#var:name}}| | ||
+ | aggregate={{#var:aggregate}}| | ||
+ | return_type={{#var:return_type}}| | ||
+ | return_also={{#var:return_also}}| | ||
+ | parameter1={{Param|int|convert}}| | ||
+ | }}| | ||
+ | |||
+ | function2={{Function| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
aggregate={{#var:aggregate}}| | aggregate={{#var:aggregate}}| | ||
Line 12: | Line 20: | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param|string|name}}| | parameter1={{Param|string|name}}| | ||
− | p1desc={{Pspan|name}} is the class name to convert| | + | p1desc={{Pspan|name}} is the class int or name to convert| |
}}| | }}| | ||
function_description=Returns the specified class {{pspan|name}} as a class.| | function_description=Returns the specified class {{pspan|name}} as a class.| | ||
+ | code1={{CodeSample| | ||
+ | title=Code Samples| | ||
+ | description=Following example shows basic to_class operations.|| | ||
+ | code= | ||
+ | <syntaxhighlight> | ||
+ | print(to_class("DiScO BanDiT"), "green"); | ||
+ | print(to_class("disco ban"), "red"); | ||
+ | print(""); | ||
+ | if (to_class("DiScO BanDiT") == my_class()) | ||
+ | print("I am a Disco Bandit!", "green"); | ||
+ | else print("I am not a Disco Bandit...", "blue"); | ||
+ | </syntaxhighlight>| | ||
+ | moreinfo= | ||
+ | It gives the following output (for DBs). | ||
+ | <pre> | ||
+ | Disco Bandit | ||
+ | none | ||
− | + | I am a Disco Bandit! | |
+ | </pre> | ||
+ | }}| | ||
special=Unlike direct casting with $class[ ], this function is case-insensitive. Full name is still required (partial names, or names with extra characters, return $class[ none ]).| | special=Unlike direct casting with $class[ ], this function is case-insensitive. Full name is still required (partial names, or names with extra characters, return $class[ none ]).| |
Latest revision as of 14:39, 26 January 2015
Function Syntax
- name is the class int or name to convert
Returns the specified class name as a class.
Code Samples
Following example shows basic to_class operations.
print(to_class("DiScO BanDiT"), "green");
print(to_class("disco ban"), "red");
print("");
if (to_class("DiScO BanDiT") == my_class())
print("I am a Disco Bandit!", "green");
else print("I am not a Disco Bandit...", "blue");
It gives the following output (for DBs).
Disco Bandit none I am a Disco Bandit!
Special
Unlike direct casting with $class[ ], this function is case-insensitive. Full name is still required (partial names, or names with extra characters, return $class[ none ]).