Skip to content

Commit

Permalink
Added GetStack and GetInfo methods to ILuaBase
Browse files Browse the repository at this point in the history
  • Loading branch information
danielga committed Oct 20, 2021
1 parent 07153cd commit 4eedd81
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/GarrysMod/Lua/LuaBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "SourceCompat.h"

struct lua_State;
struct lua_Debug;

namespace GarrysMod
{
Expand All @@ -24,6 +25,8 @@ namespace GarrysMod
int luaL_typerror( lua_State *L, int narg, const char *tname );
const void *lua_topointer( lua_State *L, int idx );
int luaL_callmeta( lua_State *L, int idx, const char *e );
int lua_getstack( lua_State *L, int level, lua_Debug *ar );
int lua_getinfo( lua_State *L, const char *what, lua_Debug *ar );
}

typedef int ( *CFunc )( lua_State* L );
Expand Down Expand Up @@ -430,6 +433,18 @@ namespace GarrysMod
return static_cast<int>( INDEX_GLOBAL ) - iPos;
}

// Get information about the interpreter runtime stack
inline int GetStack( int level, lua_Debug *ar )
{
return lua_getstack( state, level, ar );
}

// Returns information about a specific function or function invocation
inline int GetInfo( const char *what, lua_Debug *ar )
{
return lua_getinfo( state, what, ar );
}

private:
lua_State *state;
};
Expand Down

0 comments on commit 4eedd81

Please sign in to comment.