LuaJIT
lastmod 2022-01-11created 2017-09-208 edits
LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language. Lua is a powerful, dynamic and light-weight programming language. It may be embedded or used as a general-purpose, stand-alone language.
LuaJIT is Copyright © 2005-2017 Mike Pall, released under the MIT open source license.
Troubleshooting
lua_open returns null using luaJIT
If you're building a 64 bit application on OSX which links directly or indirectly against LuaJIT, you need to link your main executable with these flags:
The important point is that the flags above must be passed as EXE link flags, not to the Shared Library.
macOS Catalina luaL_newstate() error
After the macOS Catalina update, initialization may not complete properly when calling luaL_newstate. If you use LuaJIT 2.0.5, check and apply the change below.
diff --git a/external/luajit/src/lj_alloc.c b/external/luajit/src/lj_alloc.c
index dc64dca9..c66aba3e 100644
--- a/external/luajit/src/lj_alloc.c
+++ b/external/luajit/src/lj_alloc.c
@@ -177,7 +177,7 @@ static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size)
#if LJ_64
/* 64 bit mode needs special support for allocating memory in the lower 2GB. */
-#if defined(MAP_32BIT)
+#if defined(MAP_32BIT) && (LUAJIT_OS != LUAJIT_OS_OSX)
#if defined(__sun__)
#define MMAP_REGION_START ((uintptr_t)0x1000)