Skip to content

obs-scripting: Lua host code behind obs-scripting-lua-host.h (#882) - #1987

Merged
zackees merged 2 commits into
masterfrom
facade/882-lua-host
Oct 23, 2026
Merged

zackees merged 2 commits into
masterfrom
facade/882-lua-host

Conversation

@zackees

@zackees zackees commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Refs #882 (slice 1 of 3: Lua). Follows the #1292 pattern.

The Lua C module search path (package.cpath) is built through a conditional-free host interface, obs-scripting-lua-host.h (obs_lua_host_module_dirs()), implemented in obs-scripting-lua-host-{windows,macos,posix}.c.h, each in its own unity group with its own PCH:

  • Windows: ./
  • macOS: the bundle's PlugIns folder (absolute)
  • other POSIX hosts: ./, then ../SCRIPT_DIR relative to the executable

Also:

  • SO_EXT becomes OBS_LUA_SO_EXT, defined by CMake (dll on Windows, so elsewhere). It's spliced into string literals, so it stays compile-time. The PATH_MAX buffer and <windows.h> are gone.
  • The MSVC #pragma warning block around the SWIG runtime include in obs-scripting-lua.h becomes /wd4100 /wd4189 /wd4244 /wd4267 on the two Lua unity groups.
  • ci/platform-ifdef-baseline.json: the three Lua entries (8 conditionals) go to 0.
  • cmake/cross compiles the Windows and macOS host groups.

Behavior change (macOS only): when the bundle has no PlugIns folder, the old code strcpy'd nothing and passed an uninitialized import_path to package.cpath. Now nothing is added.

RED (first commit): test_obs_scripting_lua_host_{windows,macos,posix} (Tier 2, test/cmocka/tests.d/test_obs_scripting_lua_host.cmake; each host file is plain C, so all three run on Linux) fail against empty stub hosts. Local Tier 2: 3 failed out of 400, exactly these.
GREEN: all three pass locally. ./lint passes (ifdef ratchet included), ci/test_cross_sources.py passes, and cmake/cross/docker.sh win-x64 mac-arm64 exits 0.

Tiers 1/3/4 do not apply: C build-structure refactor with no Rust or protocol code.

obs-scripting-lua-host.h with stub Windows/macOS/POSIX hosts in per-OS
unity groups; test_obs_scripting_lua_host_{windows,macos,posix} fail
against the stubs.
The package.cpath directories move into obs-scripting-lua-host-{windows,
macos,posix}; the module suffix becomes OBS_LUA_SO_EXT from CMake, the
PATH_MAX buffer and <windows.h> go, and the MSVC pragmas around the SWIG
runtime become /wd options on the Lua groups. The cross check compiles the
Windows and macOS hosts. Baseline: three obs-scripting entries (8) to 0.
On macOS, a bundle without PlugIns no longer adds an uninitialized buffer
to package.cpath.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant