From 4700991a2ca15274b50ba38e3ea6a35a19ca2821 Mon Sep 17 00:00:00 2001 From: NullBite Date: Mon, 26 Sep 2022 01:15:21 -0400 Subject: [PATCH] PM: use actual objects as key instead of string I should have been doing this from the start --- script.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script.lua b/script.lua index 2a0eebb..292836d 100644 --- a/script.lua +++ b/script.lua @@ -395,7 +395,7 @@ do --- ensure part is initialized local function initPart(part) - local part_key=tostring(part) + local part_key=part if pm[part_key] == nil then pm[part_key]={} end @@ -413,7 +413,7 @@ do --- @param init? boolean Default value for chain. Should only be set once, subsequent uses overwrite the entire chain's initial value. function PartsManager.addPartFunction(part, func, init) initPart(part) - local part_key=tostring(part) + local part_key=part if init ~= nil then pm[part_key].init=init end @@ -426,7 +426,7 @@ do function PartsManager.setInitialValue(part, init) assert(init~=nil) initPart(part) - local part_key=tostring(part) + local part_key=part pm[part_key].init=init end @@ -443,7 +443,7 @@ do --- Evaluate a part's chain to determine if it should be visible. --- @param part table An object managed by PartsManager. function PartsManager.evaluatePart(part) - local part_key=tostring(part) + local part_key=part assert(pm[part_key] ~= nil) local evalFunc=function(x, y) return y(x) end