FixNative Documentation

Back to summary

import "native/native";

Destructor class

This class allows you to add destructors to your objects.

To use, simply add an instance of this class to a field in your object. It will then call the provided callback when the object gets garbage collected. This is most useful for releasing native resources.

Initialization

static function create(func, data): Destructor
Creates a new destructor with the provided callback that will be called once this object gets garbage collected.
Note: If possible, do not allocate any memory in the callback. Also the data must not reference the original object as it would prevent deallocation and it would be most likely already destroyed at the time anyway.

Functions

function disarm()
Disables calling of the callback, use when you already destroyed the object.