This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
DarkNinja2462's profile picture

[Read New Post]Unexpected Symbol Error

Started by DarkNinja2462, 08 April 2012 - 07:18 PM
DarkNinja2462 #1
Posted 08 April 2012 - 09: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"
Cloudy #2
Posted 08 April 2012 - 09:22 PM
retun true
DarkNinja2462 #3
Posted 08 April 2012 - 09:24 PM
i feel stupid
LOLOLOLOLOLOLOLOL
DarkNinja2462 #4
Posted 08 April 2012 - 09: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()
Cloudy #5
Posted 08 April 2012 - 09:36 PM
What line does it occur on? What is the error you recieve?

Edit: Found it.


while true do()
DarkNinja2462 #6
Posted 08 April 2012 - 09:39 PM
Console:

Craft OS 1.3
>client
bios:206: [string "client"]:10: unexpected symbol
Cloudy #7
Posted 08 April 2012 - 09:42 PM
Console:

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

Read above.
EatenAlive3 #8
Posted 09 April 2012 - 01: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.