add lua_getinfo_game

This commit is contained in:
fesil 2024-02-26 13:46:59 +08:00
parent 2efde665e7
commit 2a843e0286
2 changed files with 16 additions and 0 deletions

View File

@ -797,4 +797,8 @@ extern void *LJ_WIN_LOADLIBA(const char *path);
#define LJ_DS_STR_HASH_PATCH LJ_DS #define LJ_DS_STR_HASH_PATCH LJ_DS
#endif #endif
#ifndef LJ_DS_DEBUG_GETINFO_PATCH
#define LJ_DS_DEBUG_GETINFO_PATCH LJ_DS
#endif
#endif #endif

View File

@ -538,6 +538,18 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
return lj_debug_getinfo(L, what, (lj_Debug *)ar, 0); return lj_debug_getinfo(L, what, (lj_Debug *)ar, 0);
} }
#ifdef LJ_DS_DEBUG_GETINFO_PATCH
// the api skip the @ path
LUA_API int lua_getinfo_game(lua_State *L, const char *what, lua_Debug *ar)
{
int res = lj_debug_getinfo(L, what, (lj_Debug *)ar, 0);
if (res) {
ar->source = ar->source[0] == '@' ? ar->source + 1 : ar->source;
}
return res;
}
#endif
LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar) LUA_API int lua_getstack(lua_State *L, int level, lua_Debug *ar)
{ {
int size; int size;