diff --git a/core/schemas.lua b/core/schemas.lua index c0e6ad3..524b21e 100644 --- a/core/schemas.lua +++ b/core/schemas.lua @@ -236,6 +236,8 @@ failedPurchase = "function?", programError = "function?", blink = "function?", + configSaved = "function?", + productsSaved = "function?", } local soundSchema = { diff --git a/eventHooks.lua b/eventHooks.lua index 3a54cae..67f336b 100644 --- a/eventHooks.lua +++ b/eventHooks.lua @@ -5,4 +5,6 @@ failedPurchase = nil, -- function(transaction, transactionCurrency, product, errorMessage) programError = nil, -- function(err) blink = nil, -- function(blinkState) called every 3 seconds while shop is running + configSaved = nil, -- function(config) called when config is edited (replaced) + productsSaved = nil, -- function(products) called when products object is edited (replaced) } \ No newline at end of file diff --git a/radon.lua b/radon.lua index 6ce270c..9ee796b 100644 --- a/radon.lua +++ b/radon.lua @@ -1,4 +1,4 @@ -local version = "1.3.6" +local version = "1.3.7" local configHelpers = require "util.configHelpers" local schemas = require "core.schemas" local oldPullEvent = os.pullEvent @@ -292,6 +292,9 @@ f.write("return " .. textutils.serialize(newConfig)) f.close() print("Configs updated!") + if props.configState.eventHooks and props.configState.eventHooks.configSaved then + props.configState.eventHooks.configSaved(newConfig) + end end }) elseif (props.terminalState.productsErrors and #props.terminalState.productsErrors > 0) or terminalState.activeCatagory == "products" then @@ -324,6 +327,9 @@ f.write("return " .. textutils.serialize(newConfig)) f.close() print("Products updated!") + if props.configState.eventHooks and props.configState.eventHooks.productsSaved then + props.configState.eventHooks.productsSaved(newConfig) + end end }) elseif terminalState.activeCatagory == "logs" then