| 15191 | |
| 15192 | template <typename T> |
| 15193 | decltype(auto) get(int index_offset = 0) const { |
| 15194 | using UT = meta::unqualified_t<T>; |
| 15195 | int target = index + index_offset; |
| 15196 | if constexpr (meta::is_optional_v<UT>) { |
| 15197 | using ValueType = typename UT::value_type; |
| 15198 | if constexpr (std::is_same_v<ValueType, error>) { |
| 15199 | if (valid()) { |
| 15200 | return UT(); |
| 15201 | } |
| 15202 | return UT(error(detail::direct_error, stack::get<std::string>(L, target))); |
| 15203 | } |
| 15204 | else { |
| 15205 | if (!valid()) { |
| 15206 | return UT(); |
| 15207 | } |
| 15208 | return stack::get<UT>(L, target); |
| 15209 | } |
| 15210 | } |
| 15211 | else { |
| 15212 | if constexpr (std::is_same_v<T, error>) { |
| 15213 | #if defined(SOL_SAFE_PROXIES) && SOL_SAFE_PROXIES |
| 15214 | if (valid()) { |
| 15215 | type t = type_of(L, target); |
| 15216 | type_panic_c_str(L, target, t, type::none, "bad get from protected_function_result (is an error)"); |
| 15217 | } |
| 15218 | #endif // Check Argument Safety |
| 15219 | return error(detail::direct_error, stack::get<std::string>(L, target)); |
| 15220 | } |
| 15221 | else { |
| 15222 | #if defined(SOL_SAFE_PROXIES) && SOL_SAFE_PROXIES |
| 15223 | if (!valid()) { |
| 15224 | type t = type_of(L, target); |
| 15225 | type_panic_c_str(L, target, t, type::none, "bad get from protected_function_result (is not an error)"); |
| 15226 | } |
| 15227 | #endif // Check Argument Safety |
| 15228 | return stack::get<T>(L, target); |
| 15229 | } |
| 15230 | } |
| 15231 | } |
| 15232 | |
| 15233 | type get_type(int index_offset = 0) const noexcept { |
| 15234 | return type_of(L, index + static_cast<int>(index_offset)); |
nothing calls this directly
no test coverage detected