mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-22 03:42:41 +01:00
Codechange: use std::optional<std::string_view> to make the intent of function clearer
This commit is contained in:
@@ -411,8 +411,11 @@ bool Squirrel::CallStringMethod(HSQOBJECT instance, std::string_view method_name
|
||||
{
|
||||
HSQOBJECT ret;
|
||||
if (!this->CallMethod(instance, method_name, &ret, suspend)) return false;
|
||||
if (ret._type != OT_STRING) return false;
|
||||
*res = StrMakeValid(ObjectToString(&ret));
|
||||
|
||||
auto str = ObjectToString(&ret);
|
||||
if (!str.has_value()) return false;
|
||||
|
||||
*res = StrMakeValid(*str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user