class flixel.system.debug.ConsoleUtil

Available on all platforms

A set of helper functions used by the console.

Class Fields

static function attemptToCreateInstance<T>(ClassName:String, type:Class<T>, ?Params:Array<String> = null):Dynamic

Helper function for the create and switchState commands. Attempts to create a instance of a given class name * using the given params via Type.createInstance(). Also makes sure the created object is of a certain class. * *

ClassName

The Class name *

type

Which class the created instance has to have *

Params

An optional array of constructor params *

returns

The created instance, or null

static function attemptToCreateInstance_flixel_FlxObject(ClassName:String, type:Class<FlxObject>, ?Params:Array<String> = null):Dynamic

static function attemptToCreateInstance_flixel_FlxState(ClassName:String, type:Class<FlxState>, ?Params:Array<String> = null):Dynamic

static function callFunction(Function:Dynamic, Args:Array<Dynamic>):Bool

Safely calls a function via Reflection with an array of dynamic arguments. Prevents a crash from happening * if there are too many Arguments (the additional ones are removed and the function is called anyway) or too few * *

Function

The reference to the function to call. *

Args

An array of arguments. *

returns

Whether or not it was possible to safely call the function.

static function findCommand(Alias:String, Commands:Array<Command>):Command

Searches for the Command typedef for a given Alias within a Command Array. * *

Alias

The Alias to search for. *

Commands

The array of commands to search through *

returns

The Command typdef - null if none was found.

static function getInstanceFieldsAdvanced(cl:Class<Dynamic>, ?numSuperClassesToInclude:Int = 0):Array<String>

Type.getInstanceFields() returns all fields, including all those from super classes. This function allows * controlling the number of super classes whose fields should still be included in the list using Type.getSuperClass(). * * Example: * For a class PlayState with the following inheritance: * FlxBasic -> FlxTypedGroup -> FlxGroup -> FlxState -> PlayState * numSuperClassesToInclude == 0 would only return the fields of PlayState itself * numSuperClassesToInclude == 1 would only return the fields of PlayState and FlxState etc...

static function log(Text:Dynamic):Void

Shortcut to log a text with the Console LogStyle. * *

Text

The text to log.

static function parseBool(s:String):Null<Bool>

Attempts to parse a String into a Boolean, returns * true for "true", false for "false", and null otherwise. * *

s

The String to parse *

returns

The parsed Bool

static function resolveObjectAndVariable(ObjectAndVariable:String, Object:Dynamic):PathToVariable

Attempts to find the object which contains the variable to set from the String * path, like "FlxG.state.sprite.x" so it can be accessed via Reflection. * *

ObjectAndVariable

The path to the variable as a String, for example array.length *

Object

Starting point for the search, has to contain the first object / variable of the first param *

returns

A PathToVarible typedef, or null.

static function resolveObjectAndVariableFromMap(ObjectAndVariable:String, ObjectMap:Map<String, Dynamic>):PathToVariable

Helper function for the set command. Attempts to find the object which contains the variable to set * from the String path, like "FlxG.state.sprite.x" so it can be set via Reflection. * *

ObjectAndVariable

The path to the variable as a String, for example array.length *

ObjectMap

A Map of registered objects to start the search from *

returns

A PathToVarible typedef, or null.