Skip to content

Settings

ashley edited this page Aug 7, 2026 · 1 revision

HscriptInsanity has a little utility class called

that allows you to configure certain behaviors with Hscript!

  • interpClass defines the default interpreter class used on all scripts, modules and scripted instances. This is useful if you desire to have custom behavior within the interpreter.
  • preprocessorValues is a map containing variables you can check during conditional compilation (i.e. #if #else #end). This contains all of the values defined by the Haxe compiler by default, plus an "insanity" define to know this library is being used.
  • globalVariables is a map that contains variables to include in every script. By default, only the constants true, false and null are set.
  • globalImports is a map that contains classes to import in the interpreter by default. It uses a string key for the path to the class or package, with an enum as value for the import mode ...
    IAll
    // imports every module within the package, similarly to Haxe's wildcard
    
    INormal
    // imports the module and every sub-type within it
    
    IAsName(alias:String)
    // imports the class with the specified alias
    By default, all bottom level modules are imported ('' => IAll)
  • typeProxy is a map that serves to redirect a class to another. This can be specially useful if you need to use sandboxed versions of classes to prevent jailbreaking.
    By default, the classes Std, Type and Reflect are redirected to InsanityStd, InsanityType and InsanityReflect respectively, that allow the library's scripting to interact properly with certain cases.
  • blacklist allows you to assign class or package paths to completely block in scripts. The map contains four blacklist modes with an array you can append to...
    ByPackage(false)
    // blacklists all types in the specified packages, excluding sub-packages
    
    ByPackage(true)
    // blacklists all types in the specified packages AND their sub-packages (recursive)
    
    ByModule
    // blacklists the specified modules and all types within them
    
    ByType
    // blacklists only specific types
    Nothing is blacklisted by default!

Clone this wiki locally