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

Click Events says "attempt to compare string with number expected, got string"

Started by houseofkraft, 30 August 2016 - 11:49 AM
houseofkraft #1
Posted 30 August 2016 - 01:49 PM
Hi Guys!

I am working on a new OS for CC that's in heavy beta but i am having issues with click events

Error: setup:13: attempt to compare string with number expected, got string

Code:

term.clear()
term.setBackgroundColor(colors.gray)
term.clear()
term.setCursorPos(16,8)
print("Welcome to Carbon!")
term.setCursorPos(11,10)
print("A Fast, Simple, and Secure OS")
term.setCursorPos(20,14)
term.setBackgroundColor(colors.lightGray)
print("Install")
while true do
local x, y, event, button = os.pullEvent("mouse_click")
if x > 19 and x < 26 and y == 14 then
   term.clear()
end
end

Thank you!
plazter #2
Posted 30 August 2016 - 02:01 PM
Hi Guys!

I am working on a new OS for CC that's in heavy beta but i am having issues with click events

Error: setup:13: attempt to compare string with number expected, got string

Code:

-snip-
local event, side, x, y = os.pullEvent("mouse_click")
if x >= 19 and x < 26 and y == 14 then
   term.clear()
end
-snip-

Thank you!

Try that, thats the line i use to make mine works :)/>
Edited on 30 August 2016 - 12:02 PM
houseofkraft #3
Posted 30 August 2016 - 02:10 PM
It works! Thank you!
plazter #4
Posted 30 August 2016 - 02:14 PM
(Y) Your welcome!