aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_base.h
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-12-18 20:36:43 +0100
committerGitHub <noreply@github.com>2021-12-18 20:36:43 +0100
commit8472141b79c25092c90dea24aa873bd7ff792142 (patch)
treef83851a66ec4b892786ae8a398bee3e8c5228c78 /src/script/cpp_api/s_base.h
parent1c5ece8334d050379eb99fe2ead52f9f4db44249 (diff)
downloadhax-minetest-server-8472141b79c25092c90dea24aa873bd7ff792142.tar.gz
hax-minetest-server-8472141b79c25092c90dea24aa873bd7ff792142.zip
Restructure devtest's unittests and run them in CI (#11859)
Diffstat (limited to 'src/script/cpp_api/s_base.h')
-rw-r--r--src/script/cpp_api/s_base.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_base.h b/src/script/cpp_api/s_base.h
index 06df2abe3..244d81605 100644
--- a/src/script/cpp_api/s_base.h
+++ b/src/script/cpp_api/s_base.h
@@ -125,6 +125,15 @@ protected:
friend class ModApiEnvMod;
friend class LuaVoxelManip;
+ /*
+ Subtle edge case with coroutines: If for whatever reason you have a
+ method in a subclass that's called from existing lua_CFunction
+ (any of the l_*.cpp files) then make it static and take the lua_State*
+ as an argument. This is REQUIRED because getStack() will not return the
+ correct state if called inside coroutines.
+
+ Also note that src/script/common/ is the better place for such helpers.
+ */
lua_State* getStack()
{ return m_luastack; }