@@ -30,14 +30,13 @@ std::variant<CBlip*, bool> CLuaBlipDefs::CreateBlip(lua_State* luaVM, const CVec
3030
3131 CResource* resource = &lua_getownerresource (luaVM);
3232 if (!resource)
33- throw LuaFunctionError ( " Couldn't find the resource element. Please restart the resource and try again " , false ) ;
33+ return false ;
3434
3535 CBlip* radarMarker = CStaticFunctionDefinitions::CreateBlip (resource, vecPosition, icon.value_or (0 ), size.value_or (2 ), SColorRGBA (r.value_or (255 ), g.value_or (0 ), b.value_or (0 ), a.value_or (255 )), ordering.value_or (0 ), visibleDistance.value_or (16383 ), visibleTo.value_or (nullptr ));
3636 if (!radarMarker)
3737 return false ;
3838
39- CElementGroup* elementGroup = resource->GetElementGroup ();
40- if (elementGroup)
39+ if (CElementGroup* elementGroup = resource->GetElementGroup ())
4140 elementGroup->Add (radarMarker);
4241
4342 return radarMarker;
@@ -56,14 +55,13 @@ std::variant<CBlip*, bool> CLuaBlipDefs::CreateBlipAttachedTo(lua_State* luaVM,
5655
5756 CResource* resource = &lua_getownerresource (luaVM);
5857 if (!resource)
59- throw LuaFunctionError ( " Couldn't find the resource element. Please restart the resource and try again " , false ) ;
58+ return false ;
6059
6160 CBlip* radarMarker = CStaticFunctionDefinitions::CreateBlipAttachedTo (resource, entity, icon.value_or (0 ), size.value_or (2 ), SColorRGBA (r.value_or (255 ), g.value_or (0 ), b.value_or (0 ), a.value_or (255 )), ordering.value_or (0 ), visibleDistance.value_or (16383 ), visibleTo.value_or (nullptr ));
6261 if (!radarMarker)
6362 return false ;
6463
65- CElementGroup* elementGroup = resource->GetElementGroup ();
66- if (elementGroup)
64+ if (CElementGroup* elementGroup = resource->GetElementGroup ())
6765 elementGroup->Add (radarMarker);
6866
6967 return radarMarker;
@@ -82,7 +80,7 @@ auto CLuaBlipDefs::GetBlipSize(CBlip* radarMarker) noexcept
8280auto CLuaBlipDefs::GetBlipColor (CBlip* radarMarker) noexcept
8381{
8482 SColor color = radarMarker->GetColor ();
85- return std::make_tuple ( color.R , color.G , color.B , color.A ) ;
83+ return CLuaMultiReturn< float , float , float , float >{ color.R , color.G , color.B , color.A } ;
8684}
8785
8886auto CLuaBlipDefs::GetBlipOrdering (CBlip* radarMarker) noexcept
@@ -103,7 +101,7 @@ bool CLuaBlipDefs::SetBlipIcon(CElement* radarMarker, std::uint8_t icon)
103101 return CStaticFunctionDefinitions::SetBlipIcon (radarMarker, icon);
104102}
105103
106- bool CLuaBlipDefs::SetBlipSize (lua_State* luaVM, CElement* radarMarker, std::uint8_t size) noexcept
104+ bool CLuaBlipDefs::SetBlipSize (lua_State* luaVM, CElement* radarMarker, std::uint8_t size)
107105{
108106 if (size > MAX_BLIP_SIZE)
109107 {
@@ -114,17 +112,17 @@ bool CLuaBlipDefs::SetBlipSize(lua_State* luaVM, CElement* radarMarker, std::uin
114112 return CStaticFunctionDefinitions::SetBlipSize (radarMarker, size);
115113}
116114
117- bool CLuaBlipDefs::SetBlipColor (CElement* radarMarker, std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a) noexcept
115+ bool CLuaBlipDefs::SetBlipColor (CElement* radarMarker, std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a)
118116{
119117 return CStaticFunctionDefinitions::SetBlipColor (radarMarker, SColorRGBA (r, g, b, a));
120118}
121119
122- bool CLuaBlipDefs::SetBlipOrdering (CElement* radarMarker, std::int16_t ordering) noexcept
120+ bool CLuaBlipDefs::SetBlipOrdering (CElement* radarMarker, std::int16_t ordering)
123121{
124122 return CStaticFunctionDefinitions::SetBlipOrdering (radarMarker, ordering);
125123}
126124
127- bool CLuaBlipDefs::SetBlipVisibleDistance (CElement* radarMarker, std::uint16_t visibleDistance) noexcept
125+ bool CLuaBlipDefs::SetBlipVisibleDistance (CElement* radarMarker, std::uint16_t visibleDistance)
128126{
129127 return CStaticFunctionDefinitions::SetBlipVisibleDistance (radarMarker, visibleDistance);
130128}
0 commit comments