Posted 31 December 2013 - 09:12 PM
Okay so I am making a mini operating system that will assist me in the minecraft game as well as on my server, and I am getting the same error:
Here is the function that the error occurs:
the error is at the bottom line 404 is where it says -> if arg1 == "1" then <-
and line 406 is the mainMenu() function which is empty but I shall post the code:
I could not figure it out at all, hope you can help!
Thanks
bios:339: [string "uos.lua"]:406: 'end' expected (to close 'if' at line 404)
I can't seem to find the problem :SHere is the function that the error occurs:
function homeScreen() -- Finished
redMsgCount = 0
uapi.cs()
local feed = uapi.loadConfig("whatsnew")
-- Draw Instructions
uapi.drawBox(1, 51, 19, 1, " ", txtColour, bkgColour)
uapi.printC("Press the number of the option", 19, false, txtColour, bkgColour)
-- Draw time at bottom of screen
uapi.drawBox(1, 51, 18, 1, " ", txtColour, bkgColour)
uapi.printC("Rednet Messages Received: "..redMsgCount, 18, false, txtColour, bkgColour)
-- Create top banner
uapi.drawBox(1, 51, 1, 1, " ", txtColour, bkgColour)
uapi.printC("uOS -> Welcome "..username, 1, false, txtColour, bkgColour)
-- Draw options list
paintutils.drawLine(1,2,1,17,colours[bkgColour])
paintutils.drawLine(51,2,51,17,colours[bkgcolour])
uapi.printA("1. Main menu", 3, 3, false, txtColour, bkgColour)
uapi.printA("2. CraftOS Boot", 3, 5, false, txtColour, bkgColour)
-- Draw whastnew feed
uapi.printA("What's New Feed:", 3, 7, false, txtColour, bkgColour)
uapi.printA("Unavailable", 3, 9, false, txtColour, bkgColour)
uapi.printA("Unavailable", 3, 10, false, txtColour, bkgColour)
uapi.printA("Unavailable", 3, 11, false, txtColour, bkgColour)
uapi.printA("Unavailable", 3, 12, false, txtcolour, bkgColour)
uapi.printA("Unavailable", 3, 13, false, txtColour, bkgColour)
uapi.printA("Any bugs you may find, please report them!", 3, 15, false, txtColour, bkgColour)
if not modemSide == nil then -- Opens rednet
rednet.open(modemSide)
end
while true do -- Clock, Rednet, Char Events
local event, arg1, arg2, arg3, arg4, arg5 = os.pullEventRaw()
if event == "timer" and arg1 == timer then -- Timer Input
drawTime()
elseif event == "rednet" then -- Rednet messages
intSenderID = tostring(arg1)
strSerMessage = arg2
intDisTravelled = tostring(arg3)
strMessage = textutils.unserialize(strSerMessage)
if fs.exists("msgs/"..intSenderID) == true then -- deletes message from same sender if exists
fs.delete("msgs/"..intSenderID)
end
file = fs.open("msgs/"..intSenderID, "w")
file.writeLine("Sender ID: "..intSenderID)
file.writeLine("Distance: "..intDisTravelled.." blocks away")
file.write(strMessage)
file.close()
rednet.send(arg1, "Auto:R")
redMsgCount = tonumber(redMsgCount)
redMsgCount = redMsgCount + 1
redMsgCount = tostring(redMsgCount)
uapi.printC("Rednet Messages Received: "..redMsgCount, 18, false, txtColour, bkgColour)
elseif event == "char" then -- Actual User Input
if arg1 == "1" then
break
mainMenu()
elseif arg1 == "2" then
break
termboot()
end
end
end
end
the error is at the bottom line 404 is where it says -> if arg1 == "1" then <-
and line 406 is the mainMenu() function which is empty but I shall post the code:
function mainMenu()
-- Settings (TextColour, BackgroundColour, username, password)
-- uShare (Allows file sharing)
-- uChat (Chat program)
-- uRetrieve (Has updates for uOS and programs)
-- uAPI (Installed and loaded on boot)
-- uNotepad (Text editor for uOS)
-- Terminal Boot (Boots shellOS)
end
I could not figure it out at all, hope you can help!
Thanks