Repair buggy error-handling in makeclass/getclass
This commit is contained in:
@@ -386,17 +386,35 @@ public:
|
||||
|
||||
int next(LuaSlot tab, LuaSlot key, LuaSlot value) const;
|
||||
|
||||
void getclass(LuaSlot tab, LuaSlot name) const;
|
||||
// Return true if the classname is legal.
|
||||
bool validclassname(LuaSlot value) const;
|
||||
static bool validclassname(const std::string &cname);
|
||||
|
||||
// Return the class name if x is a valid classtab.
|
||||
// Otherwise, returns empty string. If nonempty, the
|
||||
// result is guaranteed to be a validclassname.
|
||||
// This can also function as an "isclass" operator.
|
||||
std::string classname(LuaSlot x) const;
|
||||
|
||||
// Look up a class.
|
||||
// If there is a problem, returns an error message.
|
||||
// There are lots of error conditions, including such things
|
||||
// as no such class, corrupted class, classname invalid, etc.
|
||||
std::string getclass(LuaSlot tab, LuaSlot name) const;
|
||||
std::string getclass(LuaSlot tab, const char *name) const;
|
||||
std::string getclass(LuaSlot tab, const std::string &name) const;
|
||||
|
||||
// Create a class, or look up an existing class.
|
||||
// WARNING: this routine assert-fails if the parameter is not
|
||||
// a valid classname. Check the classname before calling this!
|
||||
void makeclass(LuaSlot tab, LuaSlot name) const;
|
||||
void makeclass(LuaSlot tab, const char *name) const;
|
||||
void makeclass(LuaSlot tab, const std::string &name) const;
|
||||
std::string classname(LuaSlot tab) const;
|
||||
|
||||
// Get the ID of a tangible. It's a little weird to put this in
|
||||
// this module.
|
||||
int64_t tanid(LuaSlot tab) const;
|
||||
|
||||
// There's no 'isclass' operator, but 'classname' will return empty
|
||||
// string if tab is not a valid class.
|
||||
|
||||
void movesortablekey(LuaSlot val, LuaStack &other, LuaSlot otherslot);
|
||||
|
||||
bool rawequal(LuaSlot v1, LuaSlot v2) const {
|
||||
|
||||
Reference in New Issue
Block a user