Okay, so this is absolutely breaking my brain.
if I have a script
How the heck would you delete the dynamic resource on return without leaving a memory leak? Does the Var attribute auto mark the buffer for cleanup, or do I still gotta bin it myself? Does it bin itself if called in a function? And if not, how can you do this when the thing you want to return and exit the script with is the resource itself? You can't very well call cleanup after...
The only solution I can come up with is make run a function to make the struct, that in turn runs the function inside the struct, run a return, then call function to delete the struct and its dynamic resources...
But that's stupid.
Not even sure that would work on second thought...
if I have a script
GML:
function DoThing(){
var buffer=create_buffer(64,buffer_fixed,1);
return buffer;
}
The only solution I can come up with is make run a function to make the struct, that in turn runs the function inside the struct, run a return, then call function to delete the struct and its dynamic resources...
But that's stupid.
Not even sure that would work on second thought...
Last edited: