Some more error checking for class names and tangible IDs

This commit is contained in:
2024-02-28 14:19:59 -05:00
parent 32dae0df5a
commit 0c126e62d6
8 changed files with 77 additions and 21 deletions

View File

@@ -227,13 +227,12 @@ LuaDefine(tangible_getclass, "tan",
"|The return value is a string, the class name, not"
"|the class table.") {
LuaArg tanobj;
LuaVar mt, classtab;
LuaVar classtab;
LuaRet classname;
LuaDefStack LS(L, tanobj, mt, classtab, classname);
LuaDefStack LS(L, tanobj, classtab, classname);
World *w = World::fetch_global_pointer(L);
w->tangible_get(LS, tanobj, false);
LS.getmetatable(mt, tanobj);
LS.rawget(classtab, mt, "__index");
LS.tangetclass(classtab, tanobj);
eng::string name = LS.classname(classtab);
if (name == "") {
LS.set(classname, LuaNil);