Codechange: use std::string_view for sq_pushstring

This commit is contained in:
Rubidium
2025-05-03 13:19:53 +02:00
committed by rubidium42
parent 3020e615a9
commit ec79ceb2be
17 changed files with 52 additions and 55 deletions

View File

@@ -125,7 +125,7 @@ ScriptController::ScriptController(::CompanyID company) :
/* Load the library in a 'fake' namespace, so we can link it to the name the user requested */
sq_pushroottable(vm);
sq_pushstring(vm, fake_class, -1);
sq_pushstring(vm, fake_class);
sq_newclass(vm, SQFalse);
/* Load the library */
if (!engine->LoadScript(vm, lib->GetMainScript(), false)) {
@@ -140,11 +140,11 @@ ScriptController::ScriptController(::CompanyID company) :
/* Find the real class inside the fake class (like 'sets.Vector') */
sq_pushroottable(vm);
sq_pushstring(vm, fake_class, -1);
sq_pushstring(vm, fake_class);
if (SQ_FAILED(sq_get(vm, -2))) {
throw sq_throwerror(vm, "internal error assigning library class");
}
sq_pushstring(vm, lib->GetInstanceName(), -1);
sq_pushstring(vm, lib->GetInstanceName());
if (SQ_FAILED(sq_get(vm, -2))) {
throw sq_throwerror(vm, fmt::format("unable to find class '{}' in the library '{}' version {}", lib->GetInstanceName(), library, version));
}
@@ -156,7 +156,7 @@ ScriptController::ScriptController(::CompanyID company) :
/* Now link the name the user wanted to our 'fake' class */
sq_pushobject(vm, parent);
sq_pushstring(vm, class_name, -1);
sq_pushstring(vm, class_name);
sq_pushobject(vm, obj);
sq_newclass(vm, SQTrue);
sq_newslot(vm, -3, SQFalse);