This basic object helps with the creation of scripts, along with having neat helper functions to initialize and stop scripts
It is highly recommended that you override this class to add custom defualt variables and such.
Static variables
staticblocklistImports:Array<String> = []
Contains Classes/Enums that cannot be accessed via HScript.
you may find this useful if you want your project to be more secure.
staticproxyImports:Map<String, Dynamic> = ["Type" => ProxyType]
Contains proxies for classes. So they can be sandboxed or add extra functionality.
staticregisteredUsingEntries:Array<UsingEntry> = [new UsingEntry("StringTools", function(o:Dynamic, f:String, args:Array<Dynamic>):Dynamic {
if (f == "isEof") return null;
switch (Type.typeof(o)) {
case TInt if (f == "hex"):
return StringTools.hex(o, args[0]);
case TClass(String):
if (Reflect.hasField(StringTools, f)) {
var field = Reflect.field(StringTools, f);
if (Reflect.isFunction(field)) {
return Reflect.callMethod(StringTools, field, [o].concat(args));
};
};
default:
};
return null;
}), new UsingEntry("Lambda", function(o:Dynamic, f:String, args:Array<Dynamic>):Dynamic {
if (Tools.isIterable(o)) {
if (Reflect.hasField(Lambda, f)) {
var field = Reflect.field(Lambda, f);
if (Reflect.isFunction(field)) {
return Reflect.callMethod(Lambda, field, [o].concat(args));
};
};
};
return null;
})]
Static methods
staticdestroyAll():Void
Destroys every single script found within the Iris.instances map.
*
* **WARNING**: this action CANNOT be undone.
staticdynamicfatal(x:String, ?pos:Null<PosInfos>):Void
Custom fatal error function for script wrappers.
Constructor
new(scriptCode:String, ?config:Null<AutoIrisConfig>)
Instantiates a new Script with the string value.
trace("Hello World!");
will trace "Hello World!" to the standard output.
Parameters:
scriptCode | the script to be parsed, e.g: |
|---|
Variables
Methods
call(fun:String, ?args:Array<Dynamic>):IrisCall
Calls a method on the script
Parameters:
fun | The name of the method you wanna call. |
|---|---|
args | The arguments that the method needs. |
destroy():Void
Destroys the current instance of this script
along with its parser, and also removes it from the Iris.instances map.
WARNING: this action CANNOT be undone.
exists(field:String):Bool
Checks the existance of a field or method within your script.
Parameters:
field | The field to check if exists. |
|---|
get(field:String):Dynamic
Returns a field from the script.
Parameters:
field | The field that needs to be looked for. |
|---|
parse(force:Bool = false):Expr
If you want to override the script, you should do parse(true);
just parse(); otherwise, forcing may fix some behaviour depending on your implementation.
set(name:String, value:Dynamic, allowOverride:Bool = true):Void
Sets a new field to the script
Parameters:
name | The name of your new field, scripts will be able to use the field with the name given. |
|---|---|
value | The value for your new field. |
allowOverride | If set to true, when setting the new field, we will ignore any previously set fields of the same name. |