- cleaned up resources
This commit is contained in:
Frank
2022-11-05 23:48:42 +01:00
parent 1fc9f13919
commit cb43f9c392
3 changed files with 36 additions and 31 deletions

View File

@@ -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