@@ -41,7 +41,8 @@ Debugger::Debugger(lua_State *L, EmmyDebuggerManager *manager)
4141 running(false ),
4242 skipHook(false ),
4343 blocking(false ),
44- arenaRef(nullptr ) {
44+ arenaRef(nullptr ),
45+ displayCustomTypeInfo(false ) {
4546}
4647
4748Debugger::~Debugger () {
@@ -371,7 +372,7 @@ void Debugger::GetVariable(lua_State *L, Idx<Variable> variable, int index, int
371372 variable->valueType = type;
372373
373374 if (queryHelper) {
374- if (type >= 0 && type < registeredTypes.size () && registeredTypes.test (type)
375+ if (displayCustomTypeInfo && type >= 0 && type < registeredTypes.size () && registeredTypes.test (type)
375376 && manager->extension .QueryVariableCustom (L, variable, typeName, index, depth)) {
376377 return ;
377378 }
@@ -1430,24 +1431,25 @@ void Debugger::ExecuteOnLuaThread(const Executor &exec) {
14301431}
14311432
14321433int Debugger::GetTypeFromName (const char * typeName) {
1433- if (strcmp (typeName, " nil" ) == 0 ) return LUA_TNIL;
1434- if (strcmp (typeName, " boolean" ) == 0 ) return LUA_TBOOLEAN;
1435- if (strcmp (typeName, " lightuserdata" ) == 0 ) return LUA_TLIGHTUSERDATA;
1436- if (strcmp (typeName, " number" ) == 0 ) return LUA_TNUMBER;
1437- if (strcmp (typeName, " string" ) == 0 ) return LUA_TSTRING;
1438- if (strcmp (typeName, " table" ) == 0 ) return LUA_TTABLE;
1439- if (strcmp (typeName, " function" ) == 0 ) return LUA_TFUNCTION;
1440- if (strcmp (typeName, " userdata" ) == 0 ) return LUA_TUSERDATA;
1441- if (strcmp (typeName, " thread" ) == 0 ) return LUA_TTHREAD;
1442- return -1 ; // 未知类型
1434+ if (strcmp (typeName, " nil" ) == 0 ) return LUA_TNIL;
1435+ if (strcmp (typeName, " boolean" ) == 0 ) return LUA_TBOOLEAN;
1436+ if (strcmp (typeName, " lightuserdata" ) == 0 ) return LUA_TLIGHTUSERDATA;
1437+ if (strcmp (typeName, " number" ) == 0 ) return LUA_TNUMBER;
1438+ if (strcmp (typeName, " string" ) == 0 ) return LUA_TSTRING;
1439+ if (strcmp (typeName, " table" ) == 0 ) return LUA_TTABLE;
1440+ if (strcmp (typeName, " function" ) == 0 ) return LUA_TFUNCTION;
1441+ if (strcmp (typeName, " userdata" ) == 0 ) return LUA_TUSERDATA;
1442+ if (strcmp (typeName, " thread" ) == 0 ) return LUA_TTHREAD;
1443+ return -1 ; // 未知类型
14431444}
14441445
14451446bool Debugger::RegisterTypeName (const std::string& typeName, std::string& err) {
1446- int type = GetTypeFromName (typeName.c_str ());
1447- if (type == -1 ) {
1448- err = " Unknown type name: " + typeName;
1449- return false ;
1450- }
1451- registeredTypes.set (type);
1452- return true ;
1447+ int type = GetTypeFromName (typeName.c_str ());
1448+ if (type == -1 ) {
1449+ err = " Unknown type name: " + typeName;
1450+ return false ;
1451+ }
1452+ displayCustomTypeInfo = true ;
1453+ registeredTypes.set (type);
1454+ return true ;
14531455}
0 commit comments