Jump to content




[Read New Post]Unexpected Symbol Error

help

  • You cannot reply to this topic
7 replies to this topic

#1 DarkNinja2462

  • Members
  • 107 posts
  • LocationThe 4th Dimension

Posted 08 April 2012 - 08:18 PM

I get this error when turning on the computer and running a program I call client.
I think the error is in my api.
Also, I HAVE NO IDEA WHAT I DID WRONG
CONSOLE:
bios:206: [string "internet"]:34: '=' expected
CraftOS 1.3
>client
bios:206: [string "client"]:10: unexpected symbol
My API called "Internet" located in /rom/apis/
function getSettings()
fs = io.open("/rom/config/internetConfig.cfg","r")
spath = fs:read()
shome = fs:read()
fs:close()
local sPath = string.sub(spath,12,#spath)
local sHome = string.sub(shome,23,#shome)
return sPath, sHome
end
function server()
local sPath, sHome = getSettings()
rednet.open("right")
while true do
  local event, nId, message = os.pullEvent()
  if event == "rednet_message" then
   fs = io.open(sPath..message..".txt", "r")
   page = fs:read("*a")
   fs:close()
   rednet.send(nId, page)
  end
end
end
function FTP( nSCID )
sPage = client( nSCID )
if sPage == nil then
return false
end
sPath, sHome = getSettings()
fs = io.open(sHome, "w")
fs:write(sPage)
fs:close()
retun true
end
function client( nSCID, sPage )
if sPage == nil then
  sPage = "home"
end
rednet.open("right")
rednet.send(nSCId, sPage)
id, message = rednet.receive(5)
return message
end
Pleas note that I am in the process of making an "Internet Explorer"

#2 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 08 April 2012 - 08:22 PM

retun true

#3 DarkNinja2462

  • Members
  • 107 posts
  • LocationThe 4th Dimension

Posted 08 April 2012 - 08:24 PM

i feel stupid
LOLOLOLOLOLOLOLOL

#4 DarkNinja2462

  • Members
  • 107 posts
  • LocationThe 4th Dimension

Posted 08 April 2012 - 08:27 PM

I got another unexpected symbol error in client. I don't know what I spelt wrong.
Client:
local function c()
term.clear()
term.setCursorPos(1,1)
end
sPath, sHome = internet.getSettings()
function menu()
c()
while true do()
print "------------------ Connect ------------------"
print "---------------------------------------------"
print "|										   |"
print "|										   |"
print "| 1. Connect to a server's homepage		 |"
print "| 2. Connect to a specific page			 |"
print "| 3. Quit								   |"
print "|										   |"
print "|										   |"
print "---------------------------------------------"
event, param1, param2, param3 = os.pullEvent()
if event == "char" and param1 == "3" then break end
if event == "char" and param1 == "1" then home() end
end
function home()
write("Server ID - ")
sSCID = io.read()
nSCId = tonumber(sSCID)
print("Connecting...")
bSucess = internet.FTP(nSCID)
if not bSucess then
print "Connection Error"
end
shell.run(sHome)
end
menu()


#5 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 08 April 2012 - 08:36 PM

What line does it occur on? What is the error you recieve?

Edit: Found it.


while true do()

#6 DarkNinja2462

  • Members
  • 107 posts
  • LocationThe 4th Dimension

Posted 08 April 2012 - 08:39 PM

Console:
Craft OS 1.3
>client
bios:206: [string "client"]:10: unexpected symbol


#7 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 08 April 2012 - 08:42 PM

View PostDarkNinja2462, on 08 April 2012 - 08:39 PM, said:

Console:
Craft OS 1.3
>client
bios:206: [string "client"]:10: unexpected symbol

Read above.

#8 EatenAlive3

  • New Members
  • 53 posts

Posted 09 April 2012 - 12:20 AM

A hint for these 'direct' errors: after [string "program"]:, the number is the line number the error occurs at. If your error isn't a logic issue or similar, then you can find exactly which keyword is causing the issue by dividing your line onto multiple lines of code.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users