From 36995a68c726edaa1935a8ebf684dbd324eda88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lopes?= Date: Fri, 9 Apr 2021 12:13:26 +0100 Subject: [PATCH] Added State Change Callback Functions example --- demo/examples/custom_state.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/demo/examples/custom_state.lua b/demo/examples/custom_state.lua index a24dbee..4aafed5 100644 --- a/demo/examples/custom_state.lua +++ b/demo/examples/custom_state.lua @@ -28,8 +28,18 @@ function example.func(loveframes, centerarea) frame:SetHeight(text:GetHeight() + 65) frame:SetState("newstate") + loveframes.SetStateOnOpenCallback("newstate", stateOnOpen) + loveframes.SetStateOnCloseCallback("newstate", stateOnClose) + loveframes.SetState("newstate") end -return example \ No newline at end of file +stateOnClose = function(currentState, newState) + print("Closing "..currentState.." before opening "..newState) +end +stateOnOpen = function(currentState, oldState) + print("Opening "..currentState.." after closing "..oldState) +end + +return example