Posted 14 December 2015 - 02:09 PM
Hi everyone :)/>
I'm pretty noobish on Lua programming but I was trying to make a monitor with two buttons that would toggle on/off, activating a bundled cable.
I'm using the Touchpoing API by Lyqyd and this is (roughly) the program:
Everything working fine until I try to toggle off a button: the wire won't turn off.
It turns off only when the other button is pressed, which is pretty confusing to me.. any ideas? :)/>
Thanks~
I'm pretty noobish on Lua programming but I was trying to make a monitor with two buttons that would toggle on/off, activating a bundled cable.
I'm using the Touchpoing API by Lyqyd and this is (roughly) the program:
os.loadAPI("touchpoint")
local t = touchpoint.new("top")
function spawner()
t:toggleButton("Spawner")
if rs.getBundledOutput("back", colors.white) == true then
rs.setBundledOutput("back", colors.white, false)
else
rs.setBundledOutput("back", colors.white, true)
end
end
function finestra()
t:toggleButton("Finestra")
if rs.getBundledOutput("back",colors.red) == true then
rs.setBundleOutput("back", colors.red, false)
else
rs.setBundledOutput("back",colors.red, true)
end
end
tasti = function()
t:add("Spawner", spawner, 2, 2, 14, 4, colors.red, colors.lime)
t:add("Finestra", finestra, 16, 2, 28, 4, colors.red, colors.lime)
t:draw()
end
tasti()
t:run()
Everything working fine until I try to toggle off a button: the wire won't turn off.
It turns off only when the other button is pressed, which is pretty confusing to me.. any ideas? :)/>
Thanks~