Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- thread = require("thread")
- event = require("event")
- serial = require("serialization")
- eventsTable ={}
- --------------------------------------------
- function ioFile(name,action,data)
- if action == "w" then
- local wfile=io.open(name,action)
- wfile:write(serial.serialize(data))
- wfile:close()
- elseif action == "r" then
- local rfile=io.open(name,action)
- returnedData = serial.unserialize(rfile:read())
- rfile:close()
- return returnedData
- end
- end
- eventLogging = function()
- local j = 0
- while true do
- id,x2,x3,x4,x5,x6,x7,x8 = event.pull()
- j=j+1
- eventsTable[id] = j
- ioFile("events","w",eventsTable)
- end
- end
- local yourBackgroundProcess = thread.create(eventLogging)
- yourBackgroundProcess:detach()
- while true do
- os.sleep(30)
- yourBackgroundProcess:kill()
- break
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement