Skip to content

Fix maybe_require on Lua 5.1 runtimes#163

Merged
tatsumoto-ren merged 1 commit intoAjatt-Tools:masterfrom
yqmmm:fix-lua51-searchpath
Mar 19, 2026
Merged

Fix maybe_require on Lua 5.1 runtimes#163
tatsumoto-ren merged 1 commit intoAjatt-Tools:masterfrom
yqmmm:fix-lua51-searchpath

Conversation

@yqmmm
Copy link
Copy Markdown
Contributor

@yqmmm yqmmm commented Mar 19, 2026

This fixes a startup crash in helpers.maybe_require() on mpv builds that use a Lua 5.1-compatible runtime.

maybe_require() currently calls package.searchpath(), but that API is not available on Lua 5.1/LuaJIT. On those builds, mpvacious crashes during startup when loading the optional custom_subtitle_filter module.

Reproduction

  • macOS
  • Homebrew mpv
  • mpv links against a Lua 5.1-compatible runtime
  • startup fails with:
attempt to call field 'searchpath' (a nil value)

Reference:

Fix

  • keep using package.searchpath() when available
  • add a small fallback for Lua 5.1-compatible runtimes that resolves path templates by replacing ? and checking file existence

@tatsumoto-ren tatsumoto-ren merged commit 034384d into Ajatt-Tools:master Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants