Skip to content

Commit

Permalink
Fix check_ffi_value for FFI_PTR
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Oct 25, 2024
1 parent a7b48a6 commit b8859b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lffi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ static uintptr_t check_ffi_value (lua_State *L, int i, FfiType type) {
case FFI_F64:
return static_cast<uintptr_t>(static_cast<double>(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<uintptr_t>(lua_touserdata(L, i));
case FFI_STR:
return reinterpret_cast<uintptr_t>(luaL_checkstring(L, i));
Expand Down

0 comments on commit b8859b0

Please sign in to comment.