Improvements to pretty-printer, including code to support printing classnames of tables
This commit is contained in:
@@ -345,8 +345,8 @@ lua_State *LuaCoreStack::newthread(LuaSlot target) const {
|
||||
}
|
||||
|
||||
eng::string LuaCoreStack::classname(LuaSlot input) const {
|
||||
LuaVar lookup, classtab, classname;
|
||||
LuaExtStack LS(L_, lookup, classtab, classname);
|
||||
LuaVar lookup, classtab, classname, metatable;
|
||||
LuaExtStack LS(L_, lookup, classtab, classname, metatable);
|
||||
|
||||
int xt = xtype(input);
|
||||
if (xt == LUA_TSTRING) {
|
||||
@@ -377,6 +377,14 @@ eng::string LuaCoreStack::classname(LuaSlot input) const {
|
||||
return "";
|
||||
}
|
||||
return LS.ckstring(classname);
|
||||
} else if (xt == LUA_TT_GENERAL) {
|
||||
LS.getmetatable(metatable, input);
|
||||
LS.rawget(lookup, LuaRegistry, "classnames");
|
||||
LS.rawget(classname, lookup, metatable);
|
||||
if (!LS.isstring(classname)) {
|
||||
return "";
|
||||
}
|
||||
return LS.ckstring(classname);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user