Log In  

I've hit a really bizarre error; my code has no coroutines, but it fails with "attempt to yield from outside a coroutine"

I've simplified it down as much as I could; while removing unrelated cruft (e.g. the sort function from my new project template that I wasn't actually using anywhere) the bug would arbitrarily appear or disappear.

The bug will either get triggered 100% of the time or 0% of the time when you run the cart, but its presence or disappearance arbitrarily changes depending on what other unrelated code there is in the cart.

For example, tab 0 is 15K of function foo() end repeated over and over again. They're commented out right now, and the bug is present. If you comment them back in, the bug disappears.

Commenting out the body of pqb (which prints many many u64 objects) seems to remove the bug for good (no matter how many foos I comment in or out). I'm not too experienced with metatables; I think I may be at fault for something I'm doing inside u64.__tostring? sometime variation of this code give a slightly differently-formatted error message that jumps me into the middle of my __tostring method. or maybe printh is having issues dumping so much text to the console? I dunno

I'm using pico-8 0.2.4 for windows 7.

Cart #pbomdme-0 | 2021-12-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


the more common error screen:


the more rare error screen (can be triggered if there are exactly 144 foos in tab 0)

P#102444 2021-12-12 04:06

1

If a flip() occurs in __tostring() called as a metamethod, a similar error will occur.
This flip() includes an implicit one when it takes too much time.
I am not sure if this is a bug or not.

Cart #hafawojuzo-0 | 2021-12-12 | Code ▽ | Embed ▽ | No License
1

P#102462 2021-12-12 12:47

ahh thank you! that seems likely -- I'm doing a bunch of computation without calling flip or ending _draw, and spending a lot of that time printing out things while I compute them. good to know! yeah I dunno if I'd consider it a bug or not... definitely hard to understand the error message at least.

I suppose it's still odd that the presence/absence of foos will consistently trigger or not trigger the bug

P#102537 2021-12-13 05:16

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2022-11-30 18:22:09 | 0.009s | Q:21