Jump to content




os.pullEventRaw


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

#1 Xenthera

  • Members
  • 170 posts

Posted 07 May 2013 - 11:32 AM

Quick question, i'm writing a gui and i'm using os.pullEventRaw to catch the termination event. However if I use read() it's possible to terminate while entering text. How do I stop this?

#2 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 07 May 2013 - 11:35 AM

Overwrite pullEvent with pullEventRaw

#3 Xenthera

  • Members
  • 170 posts

Posted 07 May 2013 - 11:46 AM

Duh... thanks

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 07 May 2013 - 08:13 PM

make sure that you restore it after finished with the read though.

#5 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 07 May 2013 - 10:38 PM

local oldpull=os.pullEvent
os.pullEvent=os.pullEventRaw
local function main()
-- do stuff here
end
local a,b=pcall(main)
if not a then
print(b)
os.pullEvent("key")
end
os.pullEvent=oldpull
will catch errors, ensuring it restores





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users