ComputerCraft

ComputerCraft

21M Downloads

os.pullEventRaw acting like os.pullEvent

lifewcody opened this issue ยท 3 comments

commented

I'm on 1.8.0p1 and regarding the 'terminate' event, os.pullEventRaw isn't picking it up at all, it is just terminating the program like os.pullEvent.

Was this changed?

commented

I'm unable to reproduce this: while true do print(os.pullEventRaw()) end prints out the terminate event correctly. How are you testing this?

commented

So I'm almost certain this is an issue in your code. Are you sure this works on earlier versions of ComputerCraft?

I'm pretty sure the issue is that your CLI function calls read, which internally uses os.pullEvent. When you get a terminate event, read will error exiting the program. Your best bet is probably to make a copy of read which handles termination in safer manner.

One thing to be aware of is that the terminate event ignores the event filter, meaning os.pullEventRaw("modem_message") will also get terminate events. It shouldn't cause any problems currently, but may come to bite you later on.

commented

@SquidDev

Using this:

while continue do
    print(os.pullEventRaw())
end

I get the following results

However, using the raw code of just printing everything out results correctly

Code for the issue: https://github.com/InZernetTechnologies/IPv2/blob/development/iOS/router.lua
Line 112 change to the code I put above and then it doesn't work,