1
0
Fork 0

Codefix b2c5712: [Script] Squirrel::GetRealInstance doesn't work with negative index (#13658)

pull/13660/head
Loïc Guilloux 2025-02-25 13:13:31 +01:00 committed by GitHub
parent f1b683b372
commit ae72e15951
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -511,6 +511,7 @@ bool Squirrel::CreateClassInstance(const std::string &class_name, void *real_ins
/* static */ SQUserPointer Squirrel::GetRealInstance(HSQUIRRELVM vm, int index, const char *tag)
{
if (index < 0) index += sq_gettop(vm) + 1;
Squirrel *engine = static_cast<Squirrel *>(sq_getforeignptr(vm));
std::string class_name = fmt::format("{}{}", engine->GetAPIName(), tag);
sq_pushroottable(vm);