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

how is this wrong?

Started by madscientist712, 27 February 2015 - 03:35 PM
madscientist712 #1
Posted 27 February 2015 - 04:35 PM
I have a code that runs text across the screen but for some reason it is saying on line 11 "attempt to index? (a nil value)
Here is the code :
local mon = peripheral.wrap("up")
local pos = 10

while true do

if pos ==-36 then

pos = 10
end

mon.write("Paradox Nuclear Reactor Facility")
pos = pos-1
end
Lyqyd #2
Posted 27 February 2015 - 04:42 PM
The correct side name to use would be "top", not "up".
madscientist712 #3
Posted 27 February 2015 - 04:52 PM
ok thanks
TheOddByte #4
Posted 27 February 2015 - 05:03 PM
Depending on which version of CC you're using you could also use the peripheral function that automatically finds and wraps the peripheral

local mon = peripheral.find( "monitor" )