Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LUA Debugger made from scratch by: Techial
- // Cross-Platform corrections by: Sant
- // Currently tested: Windows 7 and OpenSuse
- #ifdef WIN_32
- #pragma comment(lib,"lua5.1.lib")
- #include <conio.h>
- #else
- #include <curses.h>
- #endif
- #include <stdio.h>
- #include <iostream>
- #include <string>
- #include <sstream>
- using namespace std;
- extern "C"{
- #include "lua.h"
- #include "lualib.h"
- #include "lauxlib.h"
- }
- const char* convString(string ans)
- {
- char * lv;
- char * stringChar = new char[ans.size() + 1];
- copy(ans.begin(), ans.end(), stringChar);
- stringChar[ans.size()] = '\0';
- lv = stringChar;
- return lv;
- }
- int main()
- {
- cout << "Type in the file of the LUA file to debug, example: test.lua\nName: ";
- string ans;
- getline(cin, ans);
- #ifndef _WIN32
- clear();
- //system("clear");
- #else
- system("cls");
- #endif
- lua_State *Debug = lua_open();
- luaL_openlibs(Debug);
- luaL_dofile(Debug,convString(ans));
- lua_close(Debug);
- #ifndef WIN_32
- wgetch(0);
- #else
- getch();
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment