Jump to content

attempt to compare nil witch number


Thiago04

Recommended Posts

is giving this error, just do not know how to tidy and would like help if possible, those are the lines.
 

function isCursorOnElement(x,y,w,h)
 local mx,my = getCursorPosition ()
 local fullx,fully = guiGetScreenSize()
 cursorx,cursory = mx*fullx,my*fully
 if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
  return true
 else
  return false
 end
end

 

Link to comment
isCursorHover = function(x,y,width,height)
    local sx,sy = guiGetScreenSize()
    if isCursorShowing() then
        local cX,cY,_,_,_ = getCursorPosition()
        if cX and cY then
            if cX >= x/sx and cX <= (x+width)/sx and cY >= y/sy and cY <= (y+height)/sy then
                return true
            end
        end
    end
    return false
end

If the mouse is within the values that you enter the function, it will return true.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...