MCJack123 / craftos2

A fast, modern, and feature-filled ComputerCraft emulator written in C++.
https://www.craftos-pc.cc
Other
230 stars 26 forks source link

Erroring on "An unexpected error occured in a lua function: ..." #114

Closed ghost closed 4 years ago

ghost commented 4 years ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. .Get TRoR API
  2. Go to lua
  3. Type parallel.waitForAny(function() tror.receive end, function() tror.receiveEvents() end, function() tror.receiveScreen() end)
  4. See error

Expected behavior A clear and concise description of what you expected to happen. Receive Events, and Screen. Screenshots If applicable, add screenshots or recordings to help explain your problem. You can capture these using F2, F3, or F12. If CraftOS-PC has crashed, paste the stack trace here. https://i.imgur.com/O95hgIV.png Environment (please complete the following information):

Additional context Add any other context about the problem here.

MCJack123 commented 4 years ago

This is a bug with the library itself, and not CraftOS-PC. It uses a top-level coroutine override, meaning that any errors that happen in the library (specifically, receiveEvents) will end up crashing the entire computer. I'm not sure exactly what the error is because none is being reported. You can attach a debugger and use catch error to make it break when the error occurs, then run the code and investigate further. Also, this code was built for an older version of ComputerCraft that may not be entirely compatible with CC: Tweaked 1.8x, so the bug may be caused by some change in CraftOS.