Sorry to pull this old thread back up...but thought it might prove helpful :P
This:
Should be:
Then when you call the function you do this:
NOT this:
This:
Function delete_image(handle) Local handlenum If handle<>0 Then FreeImage handle handlenum=handle handle=0 loadedimages=loadedimages-1 DebugLog "Freed "+handlenum+" to "+handle Else DebugLog handle+" not freed" EndIf End Function
Should be:
Function delete_image(handle) Local handlenum If handle<>0 Then FreeImage handle handlenum=handle handle=0 loadedimages=loadedimages-1 DebugLog "Freed "+handlenum+" to "+handle Else DebugLog handle+" not freed" EndIf Return handle ;<----------right here...a Function is designed to return a value End Function
Then when you call the function you do this:
handle = delete_image(handle)
NOT this:
delete_image(handle) : handle = 0