lua/utils: use index2adr() instead of index arithmetic
We have a code that performs calculations to obtain the address from the given index, the address is then passed to cdataV() to get cdata value from the stack. But this doesn't work for pseudo-indexes (e.g. upvalue indexes). This patch brings index2adr() from luajit/src/lj_api.c, which accepts all kinds of indexes, so that the calculations are no longer needed. Also the helper function luaL_tocpointer() is introduced. Closes #8249 NO_DOC=bugfix
Showing
- changelogs/unreleased/gh-8249-lual_checkcdata-with-upvalues.md 5 additions, 0 deletions...elogs/unreleased/gh-8249-lual_checkcdata-with-upvalues.md
- src/lua/serializer.c 11 additions, 10 deletionssrc/lua/serializer.c
- src/lua/utils.c 57 additions, 28 deletionssrc/lua/utils.c
- src/lua/utils.h 16 additions, 3 deletionssrc/lua/utils.h
- test/app-tap/module_api.c 34 additions, 0 deletionstest/app-tap/module_api.c
- test/app-tap/module_api.test.lua 8 additions, 1 deletiontest/app-tap/module_api.test.lua
Loading
Please register or sign in to comment