auth.eapp:173: attempt to compare nil with number
Desktop code:
http://pastebin.com/6VmYTv2E
Please, help!
http://pastebin.com/6VmYTv2EPlease, please use pastebin, because this code is telling me nothing without line numbers
Yes :)/>Thanks, I'll see if I can see what is wrong
Is the file on pastebin this file: auth.eapp?
local event, button, xPos, yPos = os.pullEvent("mouse_click")
if xPos > 1 and xPos < 5 and yPos == 1 then --#line 173
settings()
end
os.pullEvent = os.pullEventRaw
I know that. Therefore, the requested help. :)/>Everything seems allright. What I can tell you is that one of the Pos variable = nil.
local event, button, xPos, yPos = os.pullEvent("mouse_click") if xPos > 1 and xPos < 5 and yPos == 1 then --#line 173 settings() end
This line would error if a mouse_click event was generated without parameters, but this is (normally) impossible. A program or function could use os.queueEvent to produce such an error, but I don't see why one would.
Alternatively, if this line:os.pullEvent = os.pullEventRaw
…was run at any point before, the event returned could be a 'terminate' event, which doesn't have parameters (eg. both xPos and yPos would be nil). A terminate event is fired when control + t is held down for an extended period of time.
function os.pullEventRaw( sFilter )
return coroutine.yield( sFilter )
end
function os.pullEvent( sFilter )
local eventData = { os.pullEventRaw( sFilter ) }
if eventData[1] == "terminate" then
error( "Terminated", 0 )
end
return table.unpack( eventData )
end
Yes, but if os.pullEvent was set to os.pullEventRaw, terminate events could be returned. os.pullEvent normally filters terminate events and errors appropriatelyfrom bios.lua
function os.pullEventRaw( sFilter ) return coroutine.yield( sFilter ) end function os.pullEvent( sFilter ) local eventData = { os.pullEventRaw( sFilter ) } if eventData[1] == "terminate" then error( "Terminated", 0 ) end return table.unpack( eventData ) end
Yes, but if os.pullEvent was set to os.pullEventRaw, terminate events could be returned. os.pullEvent normally filters terminate events and errors appropriately
Not if a filter is given, which there is. That would only happen if no filter was given or if the filter was "terminate".
os.pullEvent = os.pullEventRaw
local oldPull = os.pullEvent --#Just for if when you DO close, you can reset os.pullEvent
os.pullEvent = function(sFilter)
local eventData = { os.pullEventRaw( sFilter) }
if eventData[1 == "terminate" then
--#Do nothing!
else
return unpack(eventData)
end
end
local event,param1,param2,param3 = os.pullEvent("mouse_click")
if event == "mouse_click" then
--# Do the stuffs
end