49 lines
836 B
C++
Raw Normal View History

2020-04-20 23:02:23 -07:00
#include <iostream>
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
#include "functions.hpp"
2020-04-28 18:37:19 -07:00
#include "LuaWebSocket.h"
#include <iostream>
2020-04-20 23:02:23 -07:00
int main()
{
lua_State* L = luaL_newstate();
luaL_openlibs(L);
// Functions
lua_register(L, "info", lua_info);
// Objets
luaopen_WebSocket(L);
2020-04-20 23:02:23 -07:00
#if 0
2020-04-20 23:02:23 -07:00
luaL_dofile(L, "ia.lua");
#else
int loadStatus = luaL_loadfile(L, "ia.lua");
if (loadStatus)
{
std::cerr << "Error loading gof_server.lua" << std::endl;
std::cerr << lua_tostring(L, -1) << std::endl;
return 1;
}
else
{
std::cout << "loaded ia.lua" << std::endl;
}
try {
lua_call(L, 0, 0);
}
catch (const std::runtime_error& ex) {
std::cerr << ex.what() << std::endl;
}
#endif
2020-04-20 23:02:23 -07:00
lua_close(L);
}