#include #include "lua_class.h" using namespace std; lua* G = new lua(); int openscript(lua_State* G) { lua* L = new lua(G); const char* file = L->getstring(-1); L->pop(1); L->dofile(file); return 0; } int procdostring(lua_State* Q) { lua* L = new lua(Q); const char* str = L->getstring(-1); G->dostring(str); G->getglobal("magic"); G->push(str); G->pcall(1,1); if (G->isnumber(-1) == true) { L->push(G->getnumber(-1)); G->pop(1); return 1; }else { if (G->isbool(-1)) { L->push(G->getboolean(-1)); G->pop(1); return 1; } return 0; //Error } } void setupLuaBot(lua* L) { //Register functions L->register_func("_OpenScript",openscript); L->register_func("_SafeCall",procdostring); //L->dostring("socket = require('socket')"); L->dofile("./main.lua"); } int main() { lua* Lua = new lua(); setupLuaBot(Lua); delete Lua; return 0; }