Skip to content

Commit 9412b7e

Browse files
committed
Fix issue with coroutines
1 parent ca5d620 commit 9412b7e

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

‎Source/LuaBridge/detail/Config.h‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,26 @@
1212
#error LuaBridge 3 requires a compliant C++17 compiler, or C++17 has not been enabled !
1313
#endif
1414

15+
#if defined(LUAU_FASTMATH_BEGIN)
16+
#define LUABRIDGE_ON_LUAU 1
17+
#elif defined(LUAJIT_VERSION)
18+
#define LUABRIDGE_ON_LUAJIT 1
19+
#elif defined(RAVI_OPTION_STRING2)
20+
#define LUABRIDGE_ON_RAVI 1
21+
#elif defined(LUA_VERSION_NUM)
22+
#define LUABRIDGE_ON_LUA 1
23+
#else
24+
#error "Lua headers must be included prior to LuaBridge ones"
25+
#endif
26+
1527
/**
1628
* @brief Enable C++20 coroutine integration with Lua coroutines.
1729
*
1830
* Requires C++20 and Lua 5.2+ (lua_yieldk). Not supported on Lua 5.1, LuaJIT, or Luau.
1931
* Define LUABRIDGE_DISABLE_CXX20_COROUTINES to force-disable even when C++20 is available.
2032
*/
2133
#if !defined(LUABRIDGE_HAS_CXX20_COROUTINES)
22-
#if !defined(LUABRIDGE_DISABLE_CXX20_COROUTINES) && (__cplusplus >= 202002L || (defined(_MSC_VER) && _HAS_CXX20))
34+
#if !defined(LUABRIDGE_DISABLE_CXX20_COROUTINES) && (__cplusplus >= 202002L || (defined(_MSC_VER) && _HAS_CXX20)) && !(LUABRIDGE_ON_LUAU || LUABRIDGE_ON_LUAJIT || LUABRIDGE_ON_RAVI || LUA_VERSION_NUM < 502)
2335
#define LUABRIDGE_HAS_CXX20_COROUTINES 1
2436
#else
2537
#define LUABRIDGE_HAS_CXX20_COROUTINES 0
@@ -62,18 +74,6 @@
6274
#define LUABRIDGE_NO_SANITIZE(x)
6375
#endif
6476

65-
#if defined(LUAU_FASTMATH_BEGIN)
66-
#define LUABRIDGE_ON_LUAU 1
67-
#elif defined(LUAJIT_VERSION)
68-
#define LUABRIDGE_ON_LUAJIT 1
69-
#elif defined(RAVI_OPTION_STRING2)
70-
#define LUABRIDGE_ON_RAVI 1
71-
#elif defined(LUA_VERSION_NUM)
72-
#define LUABRIDGE_ON_LUA 1
73-
#else
74-
#error "Lua headers must be included prior to LuaBridge ones"
75-
#endif
76-
7777
#if defined(__OBJC__)
7878
#define LUABRIDGE_ON_OBJECTIVE_C 1
7979
#endif

0 commit comments

Comments
 (0)