Skip to content

LuaJIT

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:

-pagezero_size 10000 -image_base 100000000

중요한 점은 위 플래그는 Shared Library 가 아닌, EXE 링크 플래그로 전달해야 한다.

macOS Catalina luaL_newstate() error

macOS Catalina 업데이트후 luaL_newstate 호출시 초기화가 정상적으로 진행되지 않을 수 있다. LuaJIT 2.0.5 버전을 사용한다면 아래의 내용을 확인하여 수정하면 된다.

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)

See also

Favorite site