From a55959dfbb3d0b90132000c40445c73a77513473 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:00:25 +0100 Subject: [PATCH 1/2] Update Base.lua Added property functions --- Moose Development/Moose/Core/Base.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 5de2096a3..76671ffce 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -201,6 +201,7 @@ BASE = { States = {}, Debug = debug, Scheduler = nil, + Properties = {}, } -- @field #BASE.__ @@ -1109,6 +1110,31 @@ function BASE:ClearState( Object, StateName ) end end +--- Set one property of an object. +-- @param #BASE self +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @param Value The value that is stored. Note that the value can be a #string, but it can also be any other type! +function BASE:SetProperty(Key,Value) + self.Properties = self.Properties or {} + self.Properties[Key] = Value +end + +--- Get one property of an object by the key. +-- @param #BASE self +-- @param Key The key that is used as a reference of the value. Note that the key can be a #string, but it can also be any other type! +-- @return Value The value that is stored. Note that the value can be a #string, but it can also be any other type! Nil if not found. +function BASE:GetProperty(Key) + self.Properties = self.Properties or {} + return self.Properties[Key] +end + +--- Get all of the properties of an object in a table. +-- @param #BASE self +-- @return #table of values, indexed by keys. +function BASE:GetProperties() + return self.Properties +end + -- Trace section -- Log a trace (only shown when trace is on) From daffd7412acd68b8df2fbbff20530b05d2dc5fd2 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:44:35 +0100 Subject: [PATCH 2/2] Update Base.lua --- Moose Development/Moose/Core/Base.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index 76671ffce..b1a12e740 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -1466,4 +1466,3 @@ function BASE:I( Arguments ) end end -