Skip to content

Predefined functions


The loadFile function allows you to read the contents of a text file and store it as a string variable. To use it, simply provide the file path as an argument, like this:

var myList = loadFile("mylist.txt")

The syntax is:


Here, filePath is the path to the text file, relative to the rules sub-folder of your project.


When dealing with larger files, such as long lists, it is recommended that you call loadFile inside the initialize function, which is executed only once when the engine starts up. This can help improve performance and avoid potential memory issues.


The CLONE function performs a deep copy of an array or object; making it useful for scenarios where you don't want to reference the original data but instead make a separate copy of it. This function is also used in domain manipulations.

To use the function, pass the variable name as an argument.


For example:

var object = { 
    name: "foo", 
    data: {
        subArray: [0, 1, 2]

var myCopy = CLONE(object); = "fighters";


In this example, the printed output shows that modifying the myCopy object has no impact on the original object.