From 08c5c38c7bff803e6c6091fafcc0044f6cd8d6fd Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Wed, 9 Nov 2022 16:09:05 +0100 Subject: [PATCH] Changes from last FF push --- Moose Development/Moose/Utilities/Utils.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 214bf8a69..704eca831 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -2019,15 +2019,21 @@ end --- Ensure the passed object is a table. -- @param #table Object The object that should be a table. --- @return #table The object that is a table. Note that if the Object is `#nil` initially, and empty table `{}` is returned. -function UTILS.EnsureTable(Object) +-- @param #boolean ReturnNil If `true`, return `#nil` if `Object` is nil. Otherwise an empty table `{}` is returned. +-- @return #table The object that now certainly *is* a table. +function UTILS.EnsureTable(Object, ReturnNil) if Object then if type(Object)~="table" then Object={Object} end else - Object={} + if ReturnNil then + return nil + else + Object={} + end + end return Object