Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ApplicationState = 0
- AppTickTimer = 0
- AppTimerTickCount = 0
- function OnApplicationEvent(type, p1, p2, p3, p4)
- if (type == "timer") then
- term.clear()
- term.setCursorPos(1, 1)
- term.write("Timer event count: " .. AppTimerTickCount)
- AppTimerTickCount = AppTimerTickCount + 1
- else
- term.clear()
- term.setCursorPos(1, 1)
- term.write(tostring(eventType))
- term.setCursorPos(1, 2)
- term.write(tostring(p1))
- term.setCursorPos(1, 3)
- term.write(tostring(p2))
- term.setCursorPos(1, 4)
- term.write(tostring(p3))
- term.setCursorPos(1, 5)
- term.write("App state: " .. ApplicationState)
- end
- end
- function Main()
- AppTickTimer = os.startTimer(0.5)
- while true do
- local eventType, p1, p2, p3, p4 = os.pullEventRaw()
- if (eventType == "terminate") then
- term.clear()
- term.setCursorPos(1, 1)
- term.write("Application terminated!")
- term.setCursorPos(1, 2)
- break
- end
- if (eventType == "timer") then
- AppTickTimer = os.startTimer(0.5)
- end
- OnApplicationEvent(eventType, p1, p2, p3, p4)
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement