Windows compile fix

This commit is contained in:
Anonymous275
2020-11-05 16:49:49 +02:00
parent 36db73b562
commit fbbdc084a4
3 changed files with 6 additions and 21 deletions

View File

@@ -12,6 +12,7 @@
#include <future>
#include <iostream>
#include <utility>
#include <optional>
std::unique_ptr<LuaArg> CreateArg(lua_State* L, int T, int S) {
if (S > T)
@@ -566,21 +567,13 @@ int CallFunction(Lua* lua, const std::string& FuncName, std::unique_ptr<LuaArg>
Size = int(Arg->args.size());
Arg->PushArgs(luaState);
}
int R = 0;
std::string Origin = lua->GetOrigin();
#ifdef WIN32
__try {
#endif // WIN32
R = lua_pcall(luaState, Size, 1, 0);
if (CheckLua(luaState, R)) {
if (lua_isnumber(luaState, -1)) {
return int(lua_tointeger(luaState, -1));
}
int R = lua_pcall(luaState, Size, 1, 0);
if (CheckLua(luaState, R)) {
if (lua_isnumber(luaState, -1)) {
return int(lua_tointeger(luaState, -1));
}
#ifdef WIN32
} __except (Handle(GetExceptionInformation(), Origin.data())) {
}
#endif // WIN32
}
ClearStack(luaState);
return 0;

View File

@@ -71,13 +71,7 @@ void TCPClient(Client*c){
}
OnConnect(c);
while (c->GetStatus() > -1)TCPRcv(c);
#ifdef WIN32
__try{
#endif // WIN32
OnDisconnect(c, c->GetStatus() == -2);
#ifdef WIN32
}__except(Handle(GetExceptionInformation(),Sec("OnDisconnect"))){}
#endif // WIN32
OnDisconnect(c, c->GetStatus() == -2);
}
void InitClient(Client*c){
std::thread NewClient(TCPClient,c);