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