Repository navigation
Settings
ashley edited this page Sep 30, 2026
·
3 revisions
HscriptInsanity has a little utility class called
that allows you to configure certain behaviors with Hscript!
-
interpClassdefines 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. -
argumentOverflowcan be used to restrict passing in extra arguments than were specified in a function, in such case, "Too many arguments" exceptions will be thrown. Although this sets the default behavior, you may also change it per script withInterp.argumentOverflow! For compatibility reasons and some considerations, this isfalseby default. -
preprocessorValuesis 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. -
globalVariablesis a map that contains variables to include in every script. By default, only the constantstrue,falseandnullare set. -
globalImportsis 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 ...By default, all bottom level modules are imported (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
'' => IAll) -
typeProxyis 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 classesStd,TypeandReflectare redirected toInsanityStd,InsanityTypeandInsanityReflectrespectively, that allow the library's scripting to interact properly with certain cases. -
blacklistallows you to assign class or package paths to completely block in scripts. The map contains four blacklist modes with a map you can append to...OnlyByPackage(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
InsanityUnsafeTypeis blacklisted by default!
Important
blacklist now has a map instead of an array for every blacklist mode for (hopefully) better performance. Should be simple to fix as setting the path's name as the key and using true as the value!
HscriptInsanity by emi3