MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / tolua_stack_dump

Function tolua_stack_dump

Source/Lua/ToLua/tolua_fix.cpp:162–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void tolua_stack_dump(lua_State* L, int offset, const char* label) {
163 int top = lua_gettop(L) + offset;
164 if (top == 0) {
165 return;
166 }
167 std::list<std::string> msgs;
168 msgs.push_back(fmt::format("Total [{}] in lua stack: {}\n", top, label != 0 ? label : ""));
169 for (int i = -1; i >= -top; i--) {
170 int t = lua_type(L, i);
171 switch (t) {
172 case LUA_TSTRING:
173 msgs.push_back(fmt::format(" [{}] [string] {}\n", i, lua_tostring(L, i)));
174 break;
175 case LUA_TBOOLEAN:
176 msgs.push_back(fmt::format(" [{}] [boolean] {}\n", i, lua_toboolean(L, i) ? "true" : "false"));
177 break;
178 case LUA_TNUMBER:
179 msgs.push_back(fmt::format(" [{}] [number] {}\n", i, lua_tonumber(L, i)));
180 break;
181 default:
182 msgs.push_back(fmt::format(" [{}] {}\n", i, lua_typename(L, t)));
183 break;
184 }
185 }
186 LogInfo(String::join(msgs));
187}
188
189Slice tolua_toslice(lua_State* L, int narg, const char* def) {
190 if (lua_gettop(L) < abs(narg)) {

Callers

nothing calls this directly

Calls 9

lua_tonumberFunction · 0.85
LogInfoFunction · 0.85
lua_gettopFunction · 0.50
formatFunction · 0.50
lua_typeFunction · 0.50
lua_tobooleanFunction · 0.50
lua_typenameFunction · 0.50
joinFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected