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

[Lua] [Error]

Started by Pixelator, 17 September 2012 - 11:59 PM
Pixelator #1
Posted 18 September 2012 - 01:59 AM
Hello, I'm working on a monitor client program that receives status updates from all of my computers and turtles (which currently only include the two handled in the code), and I keep hitting an error code I've never seen before. The error code is

bios:206: [string "System_Monitor"]:4: ' ( ' expected

and the program is



local screen = peripheral.wrap("top")
rednet.open("bottom")

local function handle.turtle.miner(message)
screen.setCursorPos(9,2)
screen.write(message)
end

local function handle.computer.server(message)
screen.setCursorPos(28,2)
screen.write(message)
screen.setCursorPos(28,3)
screen.write("Sent: "..os.time())
end

local function handle.screenreset()
screen.setCursorPos(1,1)
screen.write("|-------- Turtles -------|- Server-Status -|")
screen.setCursorPos(1,2)
screen.write("|Miner:				  |				 |")
screen.setCursorPos(1,3)
screen.write("|Sorter:				 |				 |")
screen.setCursorPos(1,4)
screen.write("|------------------ Other -----------------|")
screen.setCursorPos(1,5)
screen.write("|										  |")
screen.setCursorPos(1,6)
screen.write("|										  |")
screen.setCursorPos(1,7)
screen.write("|										  |")
screen.setCursorPos(1,8)
screen.write("|										  |")
screen.setCursorPos(1,9)
screen.write("|------------------------------------------|")
end

handle.screenreset()

while true do
senderid, message, distance = rednet.recieve()
if senderid == 3 then handle.turtle.miner(message) end
if senderid == 0 then handle.computer.server(message) end
local event, parameter = os.pullEvent ("char")
if parameter == "c" then handle.screenreset() end
end

Any help would be hugely appreciated, thanks!
MysticT #2
Posted 18 September 2012 - 02:08 AM
You can't put . in a function name, unless there's a table before. It should be:

local handle = {}
handle.turtle = {}
function handle.turtle.miner(message)
  -- the function code
end
And like that for every function that has another table.