Codename Logo Codename Logo

Property Fields

APIWikiTools

Property Fields (get/set variables)

Property Fields provide a way to control access to script or class fields, offering more flexibility than simple variables. They are defined by specifying read and write access identifiers within parentheses after the field name.

Here is a basic Property Field usage example:

./songs/script1.hx

public var myvar(default, set):Int;

function set_myvar(val:Int):Int {
  if(val > 10) return myvar = val;
  return val;
}

./songs/[SONG NAME]/scripts/script2.hx

function create() {
    myvar = 20; // This will trigger the set call stored on the field.
}

More information about property fields here.

Particularities

As of writing this, this system presents some limitations. For example:

Written by: Jamextreme140
Last updated: 2025-09-12