Error ReportingΒΆ

  • We could also add an error reporting function to this, might be usefull! The following line is defined in YOUScript.h
#define YS_ERRORFUNCTION(fn) void fn(Instance* ysi, CallStack* stack, int stacksize, const char* msg)

YS_ERRORFUNCTION(errfunc){
printf("YOUscript error!\n");

for (int i = 0; i < stacksize; i++)
        printf("SID: %i, File: %s, Name: %s\n", i, stack[i].Filename, stack[i].Name);

printf("Message: %s\n", msg);
}

-And now lets set it in ysi

        ysi.SetErrorCallback(errfunc);

error("bla") output:
YOUscriptScript error!
SID: 1, File: somefile.ys, Name: somefunction
Message: bla