From b8859b0f70630394e48dcc25718b5a620a36629f Mon Sep 17 00:00:00 2001 From: Sainan Date: Fri, 25 Oct 2024 21:23:38 +0200 Subject: [PATCH] Fix check_ffi_value for FFI_PTR --- src/lffi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lffi.cpp b/src/lffi.cpp index 25bc41842..9b9e0feca 100644 --- a/src/lffi.cpp +++ b/src/lffi.cpp @@ -148,8 +148,8 @@ static uintptr_t check_ffi_value (lua_State *L, int i, FfiType type) { case FFI_F64: return static_cast(static_cast(luaL_checknumber(L, i))); case FFI_PTR: - if (lua_type(L, 1) != LUA_TUSERDATA) - luaL_checktype(L, 1, LUA_TLIGHTUSERDATA); + if (lua_type(L, i) != LUA_TUSERDATA) + luaL_checktype(L, i, LUA_TLIGHTUSERDATA); return reinterpret_cast(lua_touserdata(L, i)); case FFI_STR: return reinterpret_cast(luaL_checkstring(L, i));