From 4e49184da26c1e7a6ec6f962fec75cadfd4f9c1f Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 24 Apr 2020 22:53:42 +0200 Subject: [PATCH] Update Static.lua --- Moose Development/Moose/Wrapper/Static.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Static.lua b/Moose Development/Moose/Wrapper/Static.lua index 64a12a98a..16b07c03f 100644 --- a/Moose Development/Moose/Wrapper/Static.lua +++ b/Moose Development/Moose/Wrapper/Static.lua @@ -76,7 +76,7 @@ end -- @param #string StaticName Name of the DCS **Static** as defined within the Mission Editor. -- @param #boolean RaiseError Raise an error if not found. -- @return #STATIC self or *nil* -function STATIC:FindByName( StaticName ) +function STATIC:FindByName( StaticName, RaiseError ) -- Find static in DB. local StaticFound = _DATABASE:FindStatic( StaticName ) @@ -87,6 +87,10 @@ function STATIC:FindByName( StaticName ) if StaticFound then return StaticFound end + + if RaiseError == nil or RaiseError == true then + error( "STATIC not found for: " .. StaticName ) + end return nil end