Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "error_handler.hpp"
- #ifndef ERROR_HANDLER
- #define ERROR_HANDLER PRINT_AND_GRILL
- #endif
- using namespace std;
- #if ERROR_HANDLER == PRINT_AND_GRILL
- #include <cstdlib>
- #include <iostream>
- #ifdef __WIN32__
- #include <windows.h>
- #endif
- #ifdef __OBJC__
- #import <Cocoa/Cocoa.h>
- #endif
- void handle_error(error_type type, string const& msg) {
- #ifdef __WIN32__
- MessageBox(NULL, msg.c_str(), "Lua Error", MB_ICONERROR | MB_OK | MB_TASKMODAL);
- #elif __OBJC__
- NSAlert *alert = [[NSAlert alloc] init];
- [alert setMessage:@"LUA Error"];
- [alert setInformativeText:[NSString stringWithUTF8String:msg.c_str()]];
- [alert runModal];
- [alert autorelease];
- #else
- cout << "lua error: " << msg << endl;
- #endif
- exit(EXIT_SUCCESS);
- }
- #endif
Add Comment
Please, Sign In to add comment