static void printCallstack(lua_State *L, const char *errmsg = "<unspecified error>")
{
	lua_Debug dummy;
	std::ostringstream os;
	os << "Lua Error: " << errmsg;
	int level = 0;
	while(true)
	{
		int gotstack = lua_getstack(L, level, &dummy);
		if(!gotstack)
			break;
		os << luaFormatStackInfo(L, level) << "\n";
		++level;
	}
#ifdef _DEBUG
	printf("%s\n", os.str().c_str());
#else
	LOG(ERROR) << os.str();
#endif
}
Beispiel #2
0
static void printCallstack(lua_State *L)
{
    lua_Debug dummy;
    for (int level = 0; lua_getstack(L, level, &dummy); ++level)
        logerror("%s", luaFormatStackInfo(L, level).c_str());
}