mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 04:53:12 +01:00
Fix rebase
This commit is contained in:
@@ -208,38 +208,30 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
template<typename T> DukValue ToDuk(duk_context* ctx, const T& value) = delete;
|
||||
template<typename T> T FromDuk(const DukValue& s) = delete;
|
||||
|
||||
template<> inline DukValue ToDuk(duk_context* ctx, const std::nullptr_t&)
|
||||
{
|
||||
duk_push_null(ctx);
|
||||
return DukValue::take_from_stack(ctx);
|
||||
}
|
||||
|
||||
template<> inline DukValue ToDuk(duk_context* ctx, const std::string_view& value)
|
||||
{
|
||||
duk_push_lstring(ctx, value.data(), value.size());
|
||||
return DukValue::take_from_stack(ctx);
|
||||
}
|
||||
|
||||
template<size_t TLen> inline DukValue ToDuk(duk_context* ctx, const char (&value)[TLen])
|
||||
{
|
||||
duk_push_string(ctx, value);
|
||||
return DukValue::take_from_stack(ctx);
|
||||
}
|
||||
|
||||
template<typename T> DukValue ToDuk(duk_context* ctx, const std::optional<T>& value)
|
||||
{
|
||||
return value ? ToDuk(ctx, *value) : ToDuk(ctx, nullptr);
|
||||
}
|
||||
|
||||
template<> inline DukValue ToDuk(duk_context* ctx, const std::nullptr_t&)
|
||||
{
|
||||
duk_push_null(ctx);
|
||||
return DukValue::take_from_stack(ctx);
|
||||
}
|
||||
|
||||
template<> inline DukValue ToDuk(duk_context* ctx, const std::string_view& value)
|
||||
{
|
||||
duk_push_lstring(ctx, value.data(), value.size());
|
||||
return DukValue::take_from_stack(ctx);
|
||||
}
|
||||
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user