attempt to index ? ( a nil value ) :3:

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Gatling

New Member
Jul 29, 2019
2
0
0
I've just made those two programs and it does not work :/ Y ?

And I don't know how to place my buttons on the screen ( 1x 1 ) ( Help me for it too please :) )
http://pastebin.com/3ZxL8PGW : this is the first
http://pastebin.com/p9eVYcG7 : this one is for my touch screen which is a the back of my computer and i have a redstone alloy wire at the left of my ADVANCED computer .

Sorry but i'm french
I hope u will help me :)
 

gattsuru

Well-Known Member
May 25, 2013
364
103
68
Code:
m = peripheral.wrap("left")
m.clear()
The nil error comes from this point. Redstone Alloy Wire does not count as a peripheral, nor require any sort of wrapper, and attempting to wrap an invalid block returns a "nil" value, which can't do anything. If you need to change redstone states near a computer, you can make calls directly to the redstone API directly.

What you probably want to do is ;
Code:
local mon = peripheral.wrap("back")
mon.clear()
This will wrap the monitor behind the computer, and clear it. This means that both the button API and your monitor have separate wrappings to the same device -- and that's fine.

Code:
button.setTable("on",button1,1,2,3,4)
button.setTable("off",button2,5,6,7,8)
Monitors describe distance units in fairly large sizes : a single monitor describes only a maximum size of 7x5. The positions you provided will try to put the "on" button on the second line of the monitor, and the "off' button somewhere well below the monitor's drawable dimensions (specifically, on the seventh of five rows, on the fifth character of that line).

Try
Code:
button.setTable("on",button1,1,2,2,2)
button.setTable("off",button2,4,7,2,2)