mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
add clock, change exceptions, add network exceptions, fix some crashes
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include <framework/ui/ui.h>
|
||||
#include <framework/net/protocol.h>
|
||||
#include <framework/core/eventdispatcher.h>
|
||||
#include <framework/core/configs.h>
|
||||
#include <framework/core/configmanager.h>
|
||||
#include <framework/platform/platform.h>
|
||||
#include <framework/otml/otml.h>
|
||||
#include <framework/graphics/graphics.h>
|
||||
@@ -152,10 +152,10 @@ void LuaInterface::registerFunctions()
|
||||
g_lua.registerClass<Protocol>();
|
||||
|
||||
// ConfigManager
|
||||
g_lua.registerClass<Configs>();
|
||||
g_lua.bindClassStaticFunction<Configs>("set", std::bind(&Configs::set, &g_configs, _1, _2));
|
||||
g_lua.bindClassStaticFunction<Configs>("get", std::bind(&Configs::get, &g_configs, _1));
|
||||
g_lua.bindClassStaticFunction<Configs>("exists", std::bind(&Configs::exists, &g_configs, _1));
|
||||
g_lua.registerClass<ConfigManager>();
|
||||
g_lua.bindClassStaticFunction<ConfigManager>("set", std::bind(&ConfigManager::set, &g_configs, _1, _2));
|
||||
g_lua.bindClassStaticFunction<ConfigManager>("get", std::bind(&ConfigManager::get, &g_configs, _1));
|
||||
g_lua.bindClassStaticFunction<ConfigManager>("exists", std::bind(&ConfigManager::exists, &g_configs, _1));
|
||||
|
||||
// Logger
|
||||
g_lua.registerClass<Logger>();
|
||||
|
@@ -545,7 +545,7 @@ void LuaInterface::createLuaState()
|
||||
// creates lua state
|
||||
L = luaL_newstate();
|
||||
if(!L)
|
||||
throw std::runtime_error("failed to create lua state");
|
||||
logFatal("Unable to create lua state");
|
||||
|
||||
// load lua standard libraries
|
||||
luaL_openlibs(L);
|
||||
|
@@ -168,7 +168,7 @@ bool luavalue_cast(int index, std::function<void(Args...)>& func) {
|
||||
throw LuaException("attempt to call an expired lua function from C++,"
|
||||
"did you forget to hold a reference for that function?", 0);
|
||||
}
|
||||
} catch(std::exception& e) {
|
||||
} catch(LuaException& e) {
|
||||
logError("lua function callback failed: ", e.what());
|
||||
}
|
||||
};
|
||||
@@ -202,7 +202,7 @@ luavalue_cast(int index, std::function<Ret(Args...)>& func) {
|
||||
throw LuaException("attempt to call an expired lua function from C++,"
|
||||
"did you forget to hold a reference for that function?", 0);
|
||||
}
|
||||
} catch(std::exception& e) {
|
||||
} catch(LuaException& e) {
|
||||
logError("lua function callback failed: ", e.what());
|
||||
}
|
||||
return Ret();
|
||||
|
Reference in New Issue
Block a user