To class: Difference between revisions
Jump to navigation
Jump to search
imported>Eliteofdelete Updated |
imported>Eliteofdelete No edit summary |
||
Line 24: | Line 24: | ||
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 ]).