Jump to content




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


  • You cannot reply to this topic
3 replies to this topic

#1 houseofkraft

  • Members
  • 170 posts
  • LocationUSA

Posted 30 August 2016 - 12: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!

#2 plazter

  • Members
  • 134 posts

Posted 30 August 2016 - 01:01 PM

View Posthouseofkraft, on 30 August 2016 - 12:49 PM, said:

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 by plazter, 30 August 2016 - 01:02 PM.


#3 houseofkraft

  • Members
  • 170 posts
  • LocationUSA

Posted 30 August 2016 - 01:10 PM

It works! Thank you!

#4 plazter

  • Members
  • 134 posts

Posted 30 August 2016 - 01:14 PM

(Y) Your welcome!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users