Ardour  9.0-pre0-582-g084a23a80d
dump.h
Go to the documentation of this file.
1 #include <sstream>
2 #include <string>
3 
4 static std::string dumpLuaState(lua_State *L) {
5  std::stringstream ostr;
6  int i;
7  int top = lua_gettop(L);
8  ostr << "top=" << top << ":\n";
9  for (i = 1; i <= top; ++i) {
10  int t = lua_type(L, i);
11  switch(t) {
12  case LUA_TSTRING:
13  ostr << " " << i << ": '" << lua_tostring(L, i) << "'\n";
14  break;
15  case LUA_TBOOLEAN:
16  ostr << " " << i << ": " <<
17  (lua_toboolean(L, i) ? "true" : "false") << "\n";
18  break;
19  case LUA_TNUMBER:
20  ostr << " " << i << ": " << lua_tonumber(L, i) << "\n";
21  break;
22  default:
23  ostr << " " << i << ": TYPE=" << lua_typename(L, t) << ": " << lua_topointer(L, i)<< "\n";
24  break;
25  }
26  }
27  return ostr.str();
28 }
static std::string dumpLuaState(lua_State *L)
Definition: dump.h:4
const void *() lua_topointer(lua_State *L, int idx)
#define lua_tonumber(L, i)
int() lua_toboolean(lua_State *L, int idx)
#define LUA_TSTRING
Definition: lua-5.3.5/lua.h:68
#define LUA_TBOOLEAN
Definition: lua-5.3.5/lua.h:65
int() lua_type(lua_State *L, int idx)
#define LUA_TNUMBER
Definition: lua-5.3.5/lua.h:67
int() lua_gettop(lua_State *L)
#define lua_tostring(L, i)
const char *() lua_typename(lua_State *L, int tp)