@bartbes (or anyone else who can help),
I got two reports about Love2d throwing a run-time error during debugging from ZeroBrane Studio: "bad argument #1 to 'pairs' (table expected, got boolean)". The error comes from Mobdebug during initialization of Serpent serializer, which goes through several global tables to capture their entries. It seems like one of the tables occasionally get "boolean" value: {'coroutine', 'debug', 'io', 'math', 'string', 'table', 'os'}.
The reason I'm asking here instead of investigating myself is that I have not been able to reproduce it myself and can't follow-up on the first report and the error disappeared for the second user; see the discussion here: http://www.freelists.org/post/zerobrane ... art-fail,2 (the relevant code fragment is here: https://github.com/pkulchenko/ZeroBrane ... a#L139-140).
Does anyone have any idea what might have contributed to it? I patched the serializer by checking the type of the value first, but would still like to know if there is some issue I'm missing. Thanks. Paul.
0.9.2 fails during debugging with run-time error
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: 0.9.2 fails during debugging with run-time error
In my experience, when one of your stdlib tables is acting up, it's usually debug, since people like calling stuff "debug". Now, in this particular case, the bug goes away when a variable "debug" is set to false, and exists if set to true (due to '_G[g] or {}'), so that could explain its weird behaviour? The easy fix here seems to replace '_G[g] or {}' with 'require(g)'.
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
Re: 0.9.2 fails during debugging with run-time error
> it's usually debug, since people like calling stuff "debug"
@bartbes, that's a very good point. Basically, if you have a global variable "debug", you may run into the issue I see. I added a check for `type()`, which should eliminate the issue, as I didn't want to do "require", even though it could technically be better (as the user may set debug to its own table).
@bartbes, that's a very good point. Basically, if you have a global variable "debug", you may run into the issue I see. I added a check for `type()`, which should eliminate the issue, as I didn't want to do "require", even though it could technically be better (as the user may set debug to its own table).
- slime
- Solid Snayke
- Posts: 3172
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: 0.9.2 fails during debugging with run-time error
It's also a bit common to do that for 'table' (especially in example code), and 'type' – although that one's a function.
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
Re: 0.9.2 fails during debugging with run-time error
@slime, true, although in this case it turned out to be "debug", exactly as @bartbes suspected.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests