mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 03:29:00 +00:00
Revert "Build System Updated"
This commit is contained in:
+34
-32
@@ -26,38 +26,40 @@
|
||||
#include <luabind/error.hpp>
|
||||
#include <luabind/lua_include.hpp>
|
||||
|
||||
namespace luabind {
|
||||
namespace detail {
|
||||
|
||||
int pcall(lua_State *L, int nargs, int nresults)
|
||||
namespace luabind { namespace detail
|
||||
{
|
||||
int pcall(lua_State *L, int nargs, int nresults)
|
||||
{
|
||||
pcall_callback_fun e = get_pcall_callback();
|
||||
int en = 0;
|
||||
if ( e )
|
||||
{
|
||||
pcall_callback_fun e = get_pcall_callback();
|
||||
int en = 0;
|
||||
if(e)
|
||||
{
|
||||
int base = lua_gettop(L) - nargs;
|
||||
e(L);
|
||||
lua_insert(L, base); // push pcall_callback under chunk and args
|
||||
en = base;
|
||||
}
|
||||
int result = lua_pcall(L, nargs, nresults, en);
|
||||
if(en)
|
||||
lua_remove(L, en); // remove pcall_callback
|
||||
return result;
|
||||
}
|
||||
|
||||
int resume_impl(lua_State *L, int nargs, int)
|
||||
{
|
||||
#if LUA_VERSION_NUM >= 502
|
||||
int res = lua_resume(L, NULL, nargs);
|
||||
#else
|
||||
int res = lua_resume(L, nargs);
|
||||
#endif
|
||||
// Lua 5.1 added LUA_YIELD as a possible return value,
|
||||
// this was causing crashes, because the caller expects 0 on success.
|
||||
return (res == LUA_YIELD) ? 0 : res;
|
||||
}
|
||||
|
||||
int base = lua_gettop(L) - nargs;
|
||||
lua_pushcfunction(L, e);
|
||||
lua_insert(L, base); // push pcall_callback under chunk and args
|
||||
en = base;
|
||||
}
|
||||
int result = lua_pcall(L, nargs, nresults, en);
|
||||
if ( en )
|
||||
lua_remove(L, en); // remove pcall_callback
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
int resume_impl(lua_State *L, int nargs, int)
|
||||
{
|
||||
#if LUA_VERSION_NUM >= 502
|
||||
int res = lua_resume(L, NULL, nargs);
|
||||
#else
|
||||
int res = lua_resume(L, nargs);
|
||||
#endif
|
||||
|
||||
#if LUA_VERSION_NUM >= 501
|
||||
// Lua 5.1 added LUA_YIELD as a possible return value,
|
||||
// this was causing crashes, because the caller expects 0 on success.
|
||||
return (res == LUA_YIELD) ? 0 : res;
|
||||
#else
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user