Returning a simple bool works except that if something went wrong an error messge would be nice to return too.
Returning a struct from a called function does not work if it contains objects (like string) (Can not be copied)
I could pass a struct to the called function by reference containing string variables and update them in the called function
I could make the function as a class and inquire some public variables in the class. (a bit more complex )
Maybe a way to simplify the class version would be to do all processing in the instamcing call?
Any other suggestions?
How to return multiple values including string from the called function to the calling function.
My first try was returning a struct that contained a string variable.
that does not work. What works is to pass a struct by reference to the called function and let the function pass results back that way.
That works. Will probaby standardize on that unless there is a more formal or elegant method.
I have also tried another method. The functions I use are stored in a library. The library seems a bit similar to a class and it is "persistent"
If I declare a string object globally in the library (not inside one of my library functions ) I can set it in one function and retrieve it in another.
I can store the results from a function in these "global" variables and then use simple library functions to retrive them later (like "Set" and "Get"). The library acts a bit like a class.
This is a bit more complex metod but workable.
Libraries are really useful since this feature means that it is possible to keep data in the library between calls to various library functions.
I have a separate library for logging to disk that is started in the init of the EA. The File Handle is stored in a global variable in the logging library so that
functions in another library can log without knowing the file handle