This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
iliketanks1998's profile picture

Unable to get arguments from os.pullEvent() after 'transferring' it to another variable, and calling it from an API

Started by iliketanks1998, 24 March 2018 - 04:46 PM
iliketanks1998 #1
Posted 24 March 2018 - 05:46 PM
My API (linked) throws an error at line 33 when I call MTOS.pullEvent() (after calling MTOS.boot_pre() to set things up). I'm confused what's going on here because when I call MTOS.boot_pre() and then oldOS.pullEvent() in the LUA interpreter, it works fine, but bugs out when called in the API. Any help is appreciated.

Please excuse the messy/redundant code, I added it there when I was debugging. The API is a part of a psudo-OS I'm writing, it shouldn't require any other APIs but in case there are any issues they are located in the APIs directory of the linked repo.
Edited on 24 March 2018 - 04:46 PM
KingofGamesYami #2
Posted 24 March 2018 - 07:24 PM
You are pulling 9 events per call in processOSQueue. Don't do that.
iliketanks1998 #3
Posted 24 March 2018 - 10:56 PM
That's the debug mess I was talking about. I was trying to determine where/why calling an event causes an error, for some reason pulling an event works when I don't store what it returns anywhere (just pullEvent() ), but throws a indexing nil error when I try to store it ( event = pullEvent() ). Only one would be present in the finished code.
iliketanks1998 #4
Posted 24 March 2018 - 11:07 PM
Update:
capitalization is the bane of my existence.

(I typed oldOs instead of oldOS)

Not my proudest moment.