Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

External Functions

Hex Editor Neo allows you to use external functions in expressions. External functions are defined in script files, attached to structure definition files using the #pragma script preprocessor directive.

An external function accepts zero or more parameters and must always return a value (“void” functions, or procedures are not supported). External function must be written in JavaScript.

Hex Editor Neo automatically performs parameter type conversion when the function call is made. Although, make sure the value returned by the function is of correct type, as Hex Editor Neo expects a value of a given type in several places, such as in array declaration:

functions.js:
function GetArraySize()
{
    return 11/2;
}
structure.h:
#pragma script("functions.js")

struct A
{
    int array[GetArraySize()];         // error here: script returns a floating-point number, integer expected
    int array[int(GetArraySize())];    // correct
};