Posted 18 March 2016 - 03:39 AM
Hey guys, so I've been working on a networked key card access system [ worked perfectly until I tried to do what this question is about.. cheers :)/> ] and I'm attempting to do error catching on a file handle. When i first implemented a pcall() it returned false and I thought how could that be if two seconds earlier I had run the code without pcall and the file handle worked flawlessly? (file closing: successful) So now I've been trying to dig around and figure out why this has happened and am simply printing basic info to the screen. the error reads:
Which is the line of the pcall itself. I'm quite stumbled on this. The physical setup for this is as follows:
Also here is the source code
EDIT: Line 136: 'cmdpwnd' should read 'cdunn' sorry :)/>
username is the floppy's label (see picture: cdunn). password is as follows:
Any and all help is appreciated. Thanks
startup:147: attempt to call table
Which is the line of the pcall itself. I'm quite stumbled on this. The physical setup for this is as follows:
Also here is the source code
EDIT: Line 136: 'cmdpwnd' should read 'cdunn' sorry :)/>
http://pastebin.com/9hQJvzd1
username is the floppy's label (see picture: cdunn). password is as follows:
{
authentication = 'password'
}
Any and all help is appreciated. Thanks
ANSWER
--[[
the file is a table. pcall cannot call on tables so..
encapsulate it in a dummy wrapper function
--]]
local ok, err = pcall(function() return fs.open(mount.."/dc","r") end)
credit: Dragon53535Edited on 18 March 2016 - 03:07 AM