Page 1 of 1

Memory Error Handling

Posted: Sun Sep 21, 2008 10:17 pm
by zer0
So this applies to the memoryRead functions.

What is a good way to gracefully exit and report a custom error message to the user instead of having:

Image

I'm guessing that maybe an assert would be used. :?

Re: Memory Error Handling

Posted: Sun Sep 21, 2008 11:32 pm
by Administrator
Somewhere at the initialisation of your script, call showWarnings(false); to hide the warnings. Then just check the return values on your memory read operations, and return an error if something out of the ordinary happens.

Code: Select all

  local val, success = memoryReadInt(...);
  if( not success ) then
    error("Memory read error!\n", 0);
  end
You probably will need to upgrade your MicroMacro for showWarnings() to be available.

Re: Memory Error Handling

Posted: Mon Sep 22, 2008 10:40 pm
by zer0
Cool, thanks. I'll give it a try when I get round to it. :)