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

Bios error?

Started by RedWolfie, 17 June 2016 - 05:25 PM
RedWolfie #1
Posted 17 June 2016 - 07:25 PM
i got this error when I broke the monitor while it was wrapped while os.pullEvent()

bios:190: attempt to compare __lt on nil and number

I just thought this should be brought to the attention of the computercraft buy.
im running Computercraft 1.7.5 for 1.7.10.

thanks
Bomb Bloke #2
Posted 18 June 2016 - 12:55 AM
Just "wrapped", or "redirected to"…? The line in context suggests that you rigged things so that the system would try to write to the disconnected display.
Edited on 17 June 2016 - 10:56 PM
theoriginalbit #3
Posted 18 June 2016 - 01:08 AM
Damn, Bomb you beat me, now to rewrite slightly.

As some context on that error: attempt to compare __lt on nil and number

__lt means 'less than comparison', If you take a look at the line Bomb Bloke linked you'd see that it checks to see if the length of the text is greater than the width of the terminal. There is no way for string.len to return nil, so w is nil. You can also determine this by the order it specifies the types, attempt to compare __lt on left hand side and right hand side, and since our operator in use is greater than you just invert the sides.
Edited on 17 June 2016 - 11:09 PM
Selim #4
Posted 18 June 2016 - 01:09 AM
Just "wrapped", or "redirected to"…? The line in context suggests that you rigged things so that the system would try to write to the disconnected display.
Isn't that the wrong bios.lua file anyways? The one in the repo will be for the latest CC, and he is using 1.7.5. Plus, doesn't "_lt" mean "less than"? The line it is pointing out doesn't use a less than, only a greater than. I'm pretty sure that is the wrong file.

Edit: theoriginalbit beat me, and taught me something while doing so…darn. Didn't realize that it will just flip the error if the error isn't a less than.
Edit 2: Darn, I was too quick to jump to conclusions. I went and looked at the file history, the bios.lua hasn't changed since 1.7.4.
Edited on 17 June 2016 - 11:13 PM
theoriginalbit #5
Posted 18 June 2016 - 01:14 AM
Isn't that the wrong bios.lua file anyways? The one in the repo will be for the latest CC, and he is using 1.7.5.
That's the correct bios.lua file. There are tags on the repo for the different CC versions. If you look at the URL its on a particular blob (2578a654b038c998bca3241b8638d8683c6423ef) which is the 1.75 version of CC.
Selim #6
Posted 18 June 2016 - 01:17 AM
–snip–
Thank explains why the file hasn't changed…I thought it did, thanks for the clarification there.
Bomb Bloke #7
Posted 18 June 2016 - 01:17 AM
Indeed. The latest version of bios.lua was changed by the latest CC update, 1.79.

By the way, is it just me or is file history unnecessarily complex to navigate under Github? As opposed to, say, the SVNs of yore? There seems to be no way to get a page listing all versions of a specific file, without any unassociated rubbish.
Edited on 17 June 2016 - 11:19 PM
theoriginalbit #8
Posted 18 June 2016 - 01:28 AM
By the way, is it just me or is file history unnecessarily complex to navigate under Github? As opposed to, say, the SVNs of yore? There seems to be no way to get a page listing all versions of a specific file, without any unassociated rubbish.
You can do it in Git with git log -p file, but GitHub doesn't have a way to do so.
Bomb Bloke #9
Posted 18 June 2016 - 01:35 AM
Ugh. Well that explains why I couldn't figure it out.

Never understood how Git managed to take over. Back when it started to become popular, I installed the relevant software and found it to be an unreliable mess (working with XBMC, mind you, a project with about a gig worth of source files at the time). Years later XKCD comes out with this, suggesting that absolutely nothing's changed.
theoriginalbit #10
Posted 18 June 2016 - 01:52 AM
Never understood how Git managed to take over.
The main reason Git took over is because it’s incredibly fast, very efficient with large projects, and it has an amazing branching system; which is great for software teams, particularly those with many developers. I would suggest reading Chapter 1 of the Pro Git book, it explains the benefits of Git over other VCSs and how it achieves the benefits. Might help with understanding Git.

Anyway, lets stop derailing this topic.
RedWolfie #11
Posted 19 June 2016 - 08:04 AM
I solved the issue by doing a term.redirect to stored table of previous term on an event pull.
if I dont redirect the term on peripheral_detach and arg1 is "monitor" then thats the error I get.

on first responder, it was wrapped via a redirect as explained on the wiki
local mon = peripheral.find("monitor")
local oldTerm = term.redirect(mon)