Merge pull request #19 from ReDucTor/feature/vscript

Fixing load/restore issue with classes that existed before
This commit is contained in:
Blixibon 2020-06-11 09:59:15 -05:00 committed by GitHub
commit 05303c9e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1675,8 +1675,16 @@ bool SquirrelVM::RegisterClass(ScriptClassDesc_t* pClassDesc)
// Check if class name is already taken // Check if class name is already taken
if (sq_get(vm_, -2) == SQ_OK) if (sq_get(vm_, -2) == SQ_OK)
{ {
sq_pop(vm_, 2); HSQOBJECT obj;
return false; sq_resetobject(&obj);
sq_getstackobj(vm_, -1, &obj);
if (!sq_isnull(obj))
{
sq_pop(vm_, 2);
return false;
}
sq_pop(vm_, 1);
} }
// Register base in case it doesn't exist // Register base in case it doesn't exist