Core Function UnsetEnum

From Sputnik Wiki
Jump to: navigation, search
UnsetEnum( <enum-name> )

Contents

Description

Delete a previous user defined Enum from Sputnik.

enum-name

The enum name to delete.

Return Value

Success: Returns 1.

Failure: Returns 0.

Remarks

This function is used to remove a previous added enum to Sputnik for example if you have a plugin system that adds a series of enum you could make the plugin remove all enum when a command is typed.

Then you could load the plugin again basically allowing an update to your programs source code while it is still running.

However anything that uses the Enum will be very unhappy to see its disappeared and they will cause a crash so its best to make sure nothing is using it before killing it.

Example

// Define a Enum called MyEnum
enum MyEnum
{
	$One,
	$Two,
	$Three
};
 
// Try make use of the enum
println("Enum value \$Three is: " . MyEnum->$Three );
 
// Now delete the enum from Sputnik
UnsetEnum("MyEnum");
 
// Try make use of the enum AGAIN
// It should crash now since the enum no longer exists
println("Enum value \$Three is: " . MyEnum->$Three );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox