Skip to content

Exposing abstracts in Hscript

ashley edited this page Aug 9, 2026 · 3 revisions

Important

This feature is very experimental and I plan to replace it with a better alternative soon, so this page may become obsolete

To make an abstract usable in Hscript, include the following metadata in your abstract:

@:build(insanity.backend.macro.AbstractMacro.build())
abstract ... {} // your abstract code here

You can apply this to abstracts from external libraries with Compiler.addMetadata or Compiler.addGlobalMetadata.

Once applied, the abstract can be imported and used in scripts! See the Working with abstracts page to learn how to use them.

Limitations

  • The abstract macro currently faces a lot of compilation errors.
    • It's recommended to only expose abstracts that use simple types rather than compound to avoid running into unexpected errors.
  • See the Working with abstracts page for some limitations with abstracts in Hscript.

Clone this wiki locally