aboutsummaryrefslogtreecommitdiff
path: root/src/compat.cpp
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2025-03-10 16:12:53 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2025-03-10 16:12:53 +0100
commitcd6169cf3ecaa41a0aec1cfddd98284fa831285c (patch)
treec34359d4874c2ef4a1b106c6d693d59bfe4bce42 /src/compat.cpp
parentd290acf78ad4291099ebccdf94d81aa60ce866bb (diff)
downloadlanes-cd6169cf3ecaa41a0aec1cfddd98284fa831285c.tar.gz
lanes-cd6169cf3ecaa41a0aec1cfddd98284fa831285c.tar.bz2
lanes-cd6169cf3ecaa41a0aec1cfddd98284fa831285c.zip
Fix unit tests failing for Lua 5.3
* Fix compatibility function lua_getiuservalue() for Lua 5.3 * Fix handling of nil function upvalues in lanes.nameof()
Diffstat (limited to 'src/compat.cpp')
-rw-r--r--src/compat.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compat.cpp b/src/compat.cpp
index c332ddc..7e90142 100644
--- a/src/compat.cpp
+++ b/src/compat.cpp
@@ -120,9 +120,9 @@ int lua_getiuservalue(lua_State* const L_, StackIndex const idx_, UserValueIndex
120#endif// LUA_VERSION_NUM > 501 120#endif// LUA_VERSION_NUM > 501
121 STACK_CHECK(L_, 1); 121 STACK_CHECK(L_, 1);
122 int const _uvType{ lua_type(L_, -1) }; 122 int const _uvType{ lua_type(L_, -1) };
123 // under Lua 5.2, there is a single uservalue that is either nil or a table. 123 // under Lua 5.2 and 5.3, there is a single uservalue, that can be nil.
124 // If nil, don't transfer it, as it can cause issues when copying to a Keeper state because of nil sentinel conversion 124 // emulate 5.4 behavior by returning LUA_TNONE when that's the case
125 return (LUA_VERSION_NUM == 502 && _uvType == LUA_TNIL) ? LUA_TNONE : _uvType; 125 return (_uvType == LUA_TNIL) ? LUA_TNONE : _uvType;
126} 126}
127 127
128// ################################################################################################# 128// #################################################################################################