Improve implementation of LS.getclass and LS.classname, make it more consistent.

This commit is contained in:
2024-09-18 16:09:05 -04:00
parent 2913f2bac2
commit 14b5c4ed8f
9 changed files with 96 additions and 104 deletions

View File

@@ -308,9 +308,6 @@
// both add functions to class 'deque', they can both makeclass 'deque',
// and no conflict will occur.
//
// Class tables contain their own classname. This is primarily for
// ease of debugging. C.__class = "deque"
//
// Class tables have a distinct LuaTableType: LUA_TT_CLASS. That
// way, it is easy to tell that the table is intended as a class.
// Class tables are treated uniquely by our engine in several ways.
@@ -769,21 +766,6 @@ public:
//
static bool validpositiveinteger(int64_t value) { return (value <= MAXINT) && (value >= 1); }
// Return true if the string is a valid lua identifier.
//
// Lua identifiers can contain ascii uppercase, ascii lowercase,
// digits, and underscores. They may not start with a digit.
//
static bool valididentifier(std::string_view id);
// Return true if the classname is legal.
//
// Returns true if value is a string, and is a valid lua identifier,
// and is not "_G".
//
bool validclassname(LuaSlot value) const;
static bool validclassname(std::string_view cname);
// Get the class name given a class table.
//
// Return the class name if x is a valid class table. Otherwise, returns