Fortunately, Challenge.Accepted, the code on line for executes successfully since LUA is pretty great at ignoring how you format your code :P/>/>
However, on lines 12 and 15 your trying to compare an integer to a function rather than whatever is returned by those function calls (I assume that's what your after?). This is not your problem though.
I removed the final end statement from your code and it was interpreted properly, however I haven't tested it with redstone. Also, with the code provided it doesn't appear that the variables 'bDataSide' and 'bVerifySide' have been defined and therefore they have 'nil' values. I'm fairly sure this is only a section of your program and those variables are declared globally.
My only suggestion is that you remove the very last end statement; it appears there is one too many.
CC forums eff'd it up when i tried to paste it so it's a little hard to read :P/>/>. When I remove an end, it tells me i should add one and when i leave it, it tells me i need another if statement. And you'd be correct, it was just part of my program and the 2 variables are defined locally. But to clarify, i have removed the end like this:
function readASCII()
dec = rs.getBundledInput( bDataSide )
if dec == 4 then
return done
end
msgp = string.char( dec )
--msg = msg..msgp
print( "Debug: "..msgp) --delete me later
rs.setBundledOutput( bVerifySide,3 )
sleep(0.5)
rs.setBundledOutput( bVerifySide,0 )
while true do
if rs.getBundledInput (bVerifySide ) == 6 then
rs.setBundledOutput( bVerifySide,0 )
return true
elseif rs.getBundledInput( bVerifySide ) == 25 then
return false
end
end
end
I did this before I made the post and it still gives me an error on line 66 of my entire program that 'end' expected to close while loop at line 47. My entire program:
Spoiler
local modelNumber = 631626677
local bDataSide = "back"
local bVerifySide = "right"
local failID = 0 --Set me
local mID = 0 --Set me too
function readASCII()
dec = rs.getBundledInput( bDataSide )
if dec == 4 then
return done
end
msgp = string.char( dec )
--msg = msg..msgp
print( "Debug: "..msgp) --delete me later
rs.setBundledOutput( bVerifySide,3 )
sleep(0.5)
rs.setBundledOutput( bVerifySide,0 )
while true do
if rs.getBundledInput (bVerifySide ) == 6 then
rs.setBundledOutput( bVerifySide,0 )
return true
elseif rs.getBundledInput( bVerifySide ) == 25 then
return false
end
end
end
if gbang.rednetOpen() == false then
print( "No modem found. Do you want to continue? Y/N" )
print( "Rednet features will be disabled.n" )
failInput = read()
end
if failInput == "Y" then
elseif failInput == "y" then
elseif failInput == "N" then
print( "Please attach a modem." )
return
elseif failInput == "n" then
print( "Please attach a modem." )
return
end
gbang.clear( 1,1 )
gbang.cPrint( "G&K Industries Standard Issue" )
gbang.cPrint( "Model Number: "..modelNumber )
while true do
os.pullEvent( "redstone" )
if rs.getBundledInput( bVerifySide ) == 1 then
if readASCII() == true then
elseif readASCII() == "end" then
rednet.send( mID,msg )
elseif readASCII() == false then
print( "Failed." )
rednet.send( failID,"Failed"..os.computerID() )
while true do
local ev,id,rnetmsg = os.pullEvent( "rednet_message" )
if id == failID then
if rnetmsg == "LOCATE "..os.computerID() then
rednet.send( failID,gps.locate() )
os.reboot()
end
end
end
end
end