summaryrefslogtreecommitdiffstats
path: root/src/luabind-5-lua-resume.patch
blob: aab5f757286f7199ec350c14976017a1a6e1a41a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
This file is part of MXE. See LICENSE.md for licensing information.

commit 61587d1b0ffa1d08874154fcdaf0644f8b5b2461
Author: Boris Nagaev <bnagaev@gmail.com>
Date:   Fri Aug 22 16:46:35 2014 +0400

    lua_resume

diff --git a/src/pcall.cpp b/src/pcall.cpp
index 66dbeaa..7a5d0c2 100755
--- a/src/pcall.cpp
+++ b/src/pcall.cpp
@@ -47,6 +47,10 @@ namespace luabind { namespace detail
 
 	int resume_impl(lua_State *L, int nargs, int)
 	{
+#if LUA_VERSION_NUM >= 502
+		int res = lua_resume(L, NULL, nargs);
+		return (res == LUA_YIELD) ? 0 : res;
+#else
 #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.
@@ -55,6 +59,7 @@ namespace luabind { namespace detail
 #else
 		return lua_resume(L, nargs);
 #endif
+#endif
 	}
 
 }}