Add isclass operator, make inspector print classes nicely
This commit is contained in:
@@ -40,6 +40,30 @@ LuaDefine(source_makeclass, "f") {
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
LuaDefine(source_isclass, "f") {
|
||||
LuaArg table;
|
||||
LuaVar classname, globtab, classtab;
|
||||
LuaRet result;
|
||||
LuaStack LS(L, table, classname, globtab, classtab, result);
|
||||
if (!LS.istable(table)) {
|
||||
LS.set(result, false);
|
||||
return LS.result();
|
||||
}
|
||||
LS.rawget(classname, table, "__class");
|
||||
if (!LS.isstring(classname)) {
|
||||
LS.set(result, false);
|
||||
return LS.result();
|
||||
}
|
||||
LS.getglobaltable(globtab);
|
||||
LS.rawget(classtab, globtab, classname);
|
||||
if (!LS.rawequal(classtab, table)) {
|
||||
LS.set(result, false);
|
||||
return LS.result();
|
||||
}
|
||||
LS.set(result, true);
|
||||
return LS.result();
|
||||
}
|
||||
|
||||
LuaDefine(source_maketangible, "f") {
|
||||
LuaArg classname;
|
||||
LuaRet classtab;
|
||||
|
||||
Reference in New Issue
Block a user