COMMUNITY

Hashlink embedded in C++, how to process data stored in the C++ side in a hashlink script?

Say I have a table or an array of vectors in C++ and I want to go over that data in a Hashlink script. Ideally I wouldn’t copy the data. It might be a meg of data or something. I just want to reference the data in a hashlink script somehow.

This would be a case of a C++ codebase running the core application but wants to call a hashlink script to process some data or do some simple behavior that might need access to data on the C++ side.
I might have missed how to do this in the docs, can anyone point me in the right direction?
Say I have a C++ side data array of a certain class, for example,

struct TRS {
    float position[3];
    float orientation[4];
    float scale[3];
};

and I want to go through those TRS’s in the hashlink script, but I don’t want to copy any data over. So it would be about referencing that memory pool.
It could be that the hashlink script calls a C++ function to bind or reference the data internally, or the C++ function call to hashlink that sends a pointer or reference to the memory pool with a size.

I found stuff related to it in the docs. It probably has to do with calling hl_dyn_setp in C++. There’s this page and this other page. The examples are obfuscated by their use of macros and templated code, and by the fact it’s trying to explain many things at once rather than one thing at a time.