Commit Graph

10 Commits

Author SHA1 Message Date
William S Fulton 294c944c10 [Lua] Restore Lua 5.1 and LuaJIT compatibility for non-director wrapping
the new Lua directors feature uses lua_setuservalue, added in Lua 5.2.
Removing the LUA_VERSION_NUM-guarded compatibility defines for lua_rawlen,
lua_pushglobaltable and lua_rawsetp/lua_rawgetp from Lib/lua/luarun.swg.

LuaJIT implements the Lua 5.1 API and, per its own documentation, is
"API+ABI-compatible with Lua 5.1, which prevents implementing features
that would otherwise break the Lua/C API and ABI" (https://luajit.org/extensions.html,
"Extensions from Lua 5.2" section) - so it never defines these Lua 5.2 additions.
Noticed when rebuilding obs-studio's LuaJIT-based Lua bindings against SWIG master.

Restore those compatibility defines, scoped to 5.1 and later only (the old
Lua 5.0-only shims are not restored).

Also revert an incidental ok!=LUA_OK comparison introduced by #3394
back to ok!=0, since LUA_OK isn't defined pre-5.2 either and luaL_dostring()
already returns 0 on success on every Lua version.

Fix the examples and test-suite where they themselves used Lua 5.2 only
features: LUA_OK in Examples/lua/embed/embed.c, _ENV in helpers.lua, and
string.format("%c", ...) in li_cdata_bytes, which yields an empty string for a
NUL byte in Lua 5.1 as strlen() is applied to the formatted result, so
string.char() is used instead.

Directors continue to require Lua 5.2 or later and are unaffected by this
change; the Lua 5.1 director test failures are addressed separately.

Assisted-by: Claude Code (Sonnet 5)
2026-07-14 20:15:39 +01:00
Erez Geva 74ff929bd4 Remove Lua 5.0 and Lua 5.1 and Lua options
- configure.ac
  - Use minimum version 5.2 for Lua
  - Add lua 5.5, it was released in dec 2025
  - Syntax improvements
- GHA CI
  - Remove 'default' Lua version, it is confusing.
    Just select the version explicitly.
  - Add Lua 5.4 test, we need to test all supported versions 5.2, 5.3 and 5.4
    Lua 5.5 is not available on Ubuntu yet.
- Lua documentation Doc/Manual/Lua.html
  - Update version to 5.2
  - Remove mention to older SWIG version,
    whom wishes to go to the very old history can look on CHANGES.
  - Add references on missing operators in Lua.
- _ENV exist from Lua 5.2.
- Remove old compatibility code from Lib/lua/luarun.swg.
- Remove LUA_VERSION_NUM from Lua C wrapping code.
  It was used for old Lua 5.0 and Lua 5.1.
- Remove _VERSION from Lua tests.
  Note: _VERSION remains a keyword and developers may use it in interface files!
- Remove Example/lua/import.lua and Examples/test-suite/lua/import.lua
  as they are not used or needed any longer.
  - Remove old Lua import.
- Add Examples/test-suite/lua/helpers.lua
  - include it in all tests in test-suite.
  - Add catch "undefined" global variables enable function.
  - Add import_to_globs function.
    To add module functions, variables and classes to global scope.
- Remove the -squash-bases option as it is broken
  The der.new_func from the example
  in the document,  "29.3.18.3 Inheritance",
  pass from base object to derived object
  regardless of using the flag or not.
- Remove -no-old-metatable-bindings as it is deprecated in the last 12 years

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2026-05-30 17:24:17 +01:00
Dimitris Apostolou 40c3bf30b2 Fix typos 2022-02-10 16:12:24 +13:00
Karl Wette f574a34155 Allow examples and test-suite to be built out of source tree
- Examples/Makefile.in rules use SRCDIR as the relative source directory

- ./config.status replicates Examples/ source directory tree in build
  directory, and copies each Makefile to build directory, prefixed with
  a header which sets SRCDIR to source directory

- Examples/test-suite/.../Makefile.in set SRCDIR from Autoconf-set srcdir

- Examples/test-suite/errors/Makefile.in needs to filter out source
  directory from SWIG error messages

- Lua: embedded interpreters are passed location of run-time test

- Python: copy run-time scripts to build directory because of 2to3
  conversion; import_packages example copies __init__.py from source
  directory; test-suite sets SCRIPTDIR to location of run-time tests

- Javascript: binding.gyp renamed to binding.gyp.in so that $srcdir
  can be substituted with SRCDIR; removed './' from require() statements
  so that NODE_PATH can be used to point Node.js to build directory
2014-05-11 23:21:10 +02:00
Olly Betts 618868ce3d Fix typos 2014-04-29 11:31:29 +12:00
William S Fulton bf313809ae Fix Lua examples for running under Lua 5.2
Includes cherry picking parts of
ce2760f77e
2014-02-22 00:43:18 +00:00
William S Fulton 079165abe2 Convert to unix fileformat 2013-01-12 16:54:45 +00:00
Mark Gossage 8350c724f5 [lua] updated docs for exceptions
added new examples (exception,embed2)
update typmaps

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10300 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-03-06 09:44:48 +00:00
William S Fulton 4926fb7f46 gcc-4.2 warning fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10185 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-12-09 13:07:20 +00:00
Mark Gossage 89c3acea19 [lua] Fix a bug in the class hierachy code, where the methods were not propagated,
if the name ordering was in a certain order.
Added new example programs (dual, embed) and runtime tests for test-suite.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10177 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-12-04 09:25:58 +00:00