Repository navigation
Metadata
ashley edited this page Aug 19, 2026
·
4 revisions
A small amount of metadatas from Haxe are supported in HscriptInsanity scripts, along with some library-specific ones...
@:bypassAccessor-
@:forward(field1, field2)is supported in scripted abstract declarations -
@:enumis supported to declare scripted enum abstracts (enum abstractalso works and is preferrable however)
-
@:safecan be used in scripted class declarations to catch exceptions thrown from instances. In the case this occurs,onInstanceErrorwill be called on the scripted class implementation.Do keep in mind that the interpreter's behavior may be impacted from caught exceptions.@:safe class SafeClass { public function new():Void { throw 'this should be caught!'; } }
-
@:snapshotcan be used in scripted class and abstract declarations to "record" static variables. Must a module be reloaded at any point, the previous state of a static variable should be restored when this metadata is used.Do note this is only guaranteed to work properly with Haxe types / source compiled classes, and behavior may become undefined when recording variables that store scripted types.class TestClass { @:snapshot public static var counter:Int = 0; // you can use the metadata in a field declaration... public function increaseCounter():Void { counter ++; } } // ...or in a class declaration instead, to record every static field! @:snapshot class TestClass { ... }
HscriptInsanity by emi3