From 06e35af6e5750ab1536d1d601753647f3abe4c91 Mon Sep 17 00:00:00 2001 From: gilzoide Date: Sun, 14 Jun 2026 15:37:59 -0300 Subject: [PATCH 1/2] Build Lua with LUA_USE_LONGJMP on web platform This works around Godot web template not being compiled with support for exceptions, although yielding from coroutines may leak memory. --- tools/lua.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lua.py b/tools/lua.py index 6bcd0fdb..8025c3cf 100644 --- a/tools/lua.py +++ b/tools/lua.py @@ -17,7 +17,9 @@ def generate(env): env.Append(CPPDEFINES="LUA_USE_ANDROID") if "32" in env["arch"]: env.Append(CPPDEFINES="LUA_USE_ANDROID_32") - elif env["platform"] != "web": + elif env["platform"] == "web": + env.Append(CPPDEFINES="LUA_USE_LONGJMP") + else: env.Append(CPPDEFINES="LUA_USE_POSIX") env.Append(CPPDEFINES=["SOL_USING_CXX_LUA=1"]) From d84184b4944de548745885b30467787b583f00e4 Mon Sep 17 00:00:00 2001 From: gilzoide Date: Sun, 21 Jun 2026 13:02:39 -0300 Subject: [PATCH 2/2] Update CHANGELOG [skip ci] --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6675ec5a..59d97184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Fixed - Exported properties of tool scripts now appear in the inspector +- Yielding from coroutines now work in Web builds. + ⚠️ Warning: we're using `longjmp` because Web export templates do not ship with C++ exception support. + This works but **memory will leak**, since objects in the stack are not cleaned by the `longjmp` as they are when handling exceptions. ## [0.8.1](https://github.com/gilzoide/lua-gdextension/releases/tag/0.8.1)