Posted 09 April 2014 - 10:11 AM
Hello,
I've got a problem. When trying to read a table from file and unserialize it, the program stops at fs.readAll() without any response. It doesn't even collapse nor it returns any kind of error. This is my code:
The cmd arguments are given by an event listener and always contain arguments gained from mouse_click event.
Output of this code stops at [Debug] CMD-read.
Does anyone know how to solve this? :?
thanx 4 any response
Oh, I forgot, the subscribers file contains a table which serialized looks like this
I've got a problem. When trying to read a table from file and unserialize it, the program stops at fs.readAll() without any response. It doesn't even collapse nor it returns any kind of error. This is my code:
args={...}
print("[Debug] Started")
function load(name)
print("[Debug] CMD-open")
local file = fs.open(name,"r")
print("[Debug] CMD-read")
local data = file.readAll()
print("[Debug] CMD-close")
file.close()
print("[Debug] Loaded")
return textutils.unserialize(data)
end
function DoWork()
print("[Debug] Loading File...")
Settings=load("../registry/HW/MouseClick/Subscribers","r")
for index,value in pairs(Settings) do
shell.run(value,"MouseClick",args)
print("[Debug] Called "..value)
end
print("[Debug] Finished")
end
if pcall(DoWork) then
else
error()
end
The cmd arguments are given by an event listener and always contain arguments gained from mouse_click event.
Output of this code stops at [Debug] CMD-read.
Does anyone know how to solve this? :?
thanx 4 any response
Oh, I forgot, the subscribers file contains a table which serialized looks like this
{
"ls",
"cd",
}
and (as u can see) contains list of programs called when the mouse_click event fires.