View difference between Paste ID: yGQWBTve and gwJHBq7E
SHOW: | | - or go back to the newest paste.
1-
local filename = ".syncro"
1+
-- pastebin get yGQWBTve syncro
2
-- std PB yGQWBTve syncro
3
4-
_G.isClient = false
4+
syncpath = ".syncro"
5
seed = math.random(1,65535)
6-
local evtqueue = {}
6+
local dennis = false
7
local tArg = {...}
8-
if parallel.waitForAny(function()
8+
9-
  sleep(0.25) end, function()
9+
function writeDown(evtbl)
10-
  while true do
10+
	if not evtbl then return false, "no event table, you idiot" end
11-
    local _,key = os.pullEvent("key")
11+
	if type(evtbl[1]) == "string" then
12-
    if key == keys.home then
12+
		evtbl[1] = "'"..evtbl[1].."'"
13-
      return
13+
	end
14-
    end
14+
	local file = fs.open(syncpath,"a")
15-
  end
15+
	file.writeLine("if seed~="..seed.." then os.queueEvent("..table.concat(evtbl,",")..") end")
16-
end) == 2 then
16+
	file.close()
17-
  _G.isClient = true
17+
18-
  print("You are client.")
18+
19
function record()
20
	local evt
21-
sliceEventLog = function(newSize)
21+
	while true do
22-
  local file = fs.open(filename,"r")
22+
		evt = {os.pullEvent()}
23-
  local line = ""
23+
		if evt[1] == "timer" then
24-
  local input = {}
24+
			dofile(syncpath)
25-
  repeat
25+
			fs.delete(syncpath)
26-
    line = file.readLine()
26+
		else
27-
    if line then
27+
			writeDown(evt)
28-
      table.insert(input,line)
28+
		end
29-
    end
29+
		dennis = false
30-
  until not line
30+
	end
31-
  file.close()
31+
32-
  file = fs.open(filename,"w")
32+
33-
  for a = #input-(newSize or 5), #input do
33+
function carryOn(...)
34-
    file.writeLine(input[a])
34+
	if arg then
35-
  end
35+
		dofile(...)
36-
  file.close()
36+
	else
37
		dofile("/rom/programs/shell")
38
	end
39-
readEvents = function()
39+
	write("Goodbye")
40-
  local lines = 0
40+
	sleep(1)
41-
  while true do
41+
	return
42-
    sleep(0)
42+
43-
    local file = fs.open(filename,"r")
43+
parallel.waitForAny(record,function() carryOn(unpack(tArg) or {"rom/programs/shell"}) end)