Posted 15 February 2016 - 09:07 PM
Hi,
I wanted to make a lift with an advanced monitor on each floor. They would all show the same thing so I connected them via the wired network.
To make coding easier I made a table with the monitor names and functions to call their methods.
now when I want do call these functions I get the error:
expected string (i.e. in line 6)
when I replace
Do you have any idea what the problem might be?
I wanted to make a lift with an advanced monitor on each floor. They would all show the same thing so I connected them via the wired network.
To make coding easier I made a table with the monitor names and functions to call their methods.
1 m = peripheral.wrap("top")
2 local monitors = {"monitor_1","monitor_2",...}
3
4 function clear()
5 for i=1,#monitors+1 do
6 m.callRemote(monitors[i],"clear")
7 end
8 end
9 function pos(x,y)
10 for i=1,#monitors+1 do
11 m.callRemote(monitors[i],"setCursorPos",x,y)
12 end
13 end
14 function col(c)
15 for i=1,#monitors+1 do
16 m.callRemote(monitors[i],"setBackgroundColor",c)
17 end
18 end
19 function write(text)
20 for i=1,#monitors+1 do
21 m.callRemote(monitors[i],"write",text)
22 end
23 end
now when I want do call these functions I get the error:
expected string (i.e. in line 6)
when I replace
m.callRemote(monitors[i],"clear")
withm.callRemote("monitor_1","clear")
it works but I would have to write more :(/>Do you have any idea what the problem might be?
Edited on 30 August 2016 - 02:30 PM