1
0
Fork 0

Codechange: introduce std::string variant of sq_pushstring

pull/10802/head
Rubidium 2023-05-04 23:48:56 +02:00 committed by rubidium42
parent f5158c8b79
commit 6e3d3c0e7c
3 changed files with 3 additions and 2 deletions

View File

@ -238,6 +238,7 @@ void sq_newclosure(HSQUIRRELVM v,SQFUNCTION func,SQUnsignedInteger nfreevars);
SQRESULT sq_setparamscheck(HSQUIRRELVM v,SQInteger nparamscheck,const SQChar *typemask);
SQRESULT sq_bindenv(HSQUIRRELVM v,SQInteger idx);
void sq_pushstring(HSQUIRRELVM v,const SQChar *s,SQInteger len);
static inline void sq_pushstring(HSQUIRRELVM v, const std::string &str, SQInteger len = -1) { sq_pushstring(v, str.c_str(), len == -1 ? str.size() : len); }
void sq_pushfloat(HSQUIRRELVM v,SQFloat f);
void sq_pushinteger(HSQUIRRELVM v,SQInteger n);
void sq_pushbool(HSQUIRRELVM v,SQBool b);

View File

@ -369,7 +369,7 @@ void RegisterGameTranslation(Squirrel *engine)
int idx = 0;
for (const auto &p : _current_data->string_names) {
sq_pushstring(vm, p.c_str(), -1);
sq_pushstring(vm, p, -1);
sq_pushinteger(vm, idx);
sq_rawset(vm, -3);
idx++;

View File

@ -618,7 +618,7 @@ bool ScriptInstance::IsPaused()
}
if (std::holds_alternative<std::string>(value)) {
sq_pushstring(vm, std::get<std::string>(value).c_str(), -1);
sq_pushstring(vm, std::get<std::string>(value), -1);
return true;
}