Skip to content

Commit 4eedd81

Browse files
committed
Added GetStack and GetInfo methods to ILuaBase
1 parent 07153cd commit 4eedd81

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/GarrysMod/Lua/LuaBase.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "SourceCompat.h"
1111

1212
struct lua_State;
13+
struct lua_Debug;
1314

1415
namespace GarrysMod
1516
{
@@ -24,6 +25,8 @@ namespace GarrysMod
2425
int luaL_typerror( lua_State *L, int narg, const char *tname );
2526
const void *lua_topointer( lua_State *L, int idx );
2627
int luaL_callmeta( lua_State *L, int idx, const char *e );
28+
int lua_getstack( lua_State *L, int level, lua_Debug *ar );
29+
int lua_getinfo( lua_State *L, const char *what, lua_Debug *ar );
2730
}
2831

2932
typedef int ( *CFunc )( lua_State* L );
@@ -430,6 +433,18 @@ namespace GarrysMod
430433
return static_cast<int>( INDEX_GLOBAL ) - iPos;
431434
}
432435

436+
// Get information about the interpreter runtime stack
437+
inline int GetStack( int level, lua_Debug *ar )
438+
{
439+
return lua_getstack( state, level, ar );
440+
}
441+
442+
// Returns information about a specific function or function invocation
443+
inline int GetInfo( const char *what, lua_Debug *ar )
444+
{
445+
return lua_getinfo( state, what, ar );
446+
}
447+
433448
private:
434449
lua_State *state;
435450
};

0 commit comments

Comments
 (0)