I am having an error with my code : it keeps telling me "attempt to index a nil value (global 'sides')"
I'm trying to learn Lua through Minecraft (OpenComputers) and found myself stuck with a nil value problem. There could be things not actually from Lua (the mod itself) but the problem concerns the "pure Lua part"
component = require("component")
event = require("event")
computer = require("computer")
term = require("term")
gpu = component.gpu
redstone = component.redstone
gpu.setResolution(160,50)
while true do
term.clear()
term.setCursor(1,1)
gpu.setBackground(0x5A5A5A)
gpu.set(1,1," Allumer lampe Eteindre lampe")
term.setCursor(1,2)
local _,_,x,y = event.pull("touch")
if x >= 2 and x <= 14 and y == 1 then
redstone.setOutput(sides.left,15)
elseif x >= 19 and x <= 32 and y == 1 then
redstone.setOutput(sides.left,0)
else
main()
end
end
I went on the Wiki of the mod and it says that redstone.setOutput(sides.left,15) is supposed to change the actual value of the output but it also returns the OLD value of the output (and that's where I think I'm doing it wrong)