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

Help with Debug (Bios: 336: expected string, string)

Started by Larroke, 22 April 2013 - 06:49 AM
Larroke #1
Posted 22 April 2013 - 08:49 AM
Title: Help with Debug (Bios: 336: expected string, string)

I'm working on an automation script but cannot sort through this last error. Background: It only throws and error the first time I run the script…

Pastebin of associated code:

bcm - http://pastebin.com/8gfvJpbE

a modified version of Direwolf20's button API.
button - http://pastebin.com/X4gZh0vc

Bios: 336 relates to the fileload routine, which is only used in the scripts by the API load call, but testing with just the API load call doesn't give me any errors. The button API is in the root directory of the computer with the bcm script.

I get the Bios error the first time I run bcm, I get a second error the first time I click the monitor buttons "button 75: attempt to call nil" but again only the first time I run the script. to get the script running I have to run it three times and everything works just fine. Currently the button's functions themselves don't do anything but change the colors (shelved this after some frustration) but now that I understand relays I want to get this level of automation going again..

Any help would be appreciated….
LBPHacker #2
Posted 23 April 2013 - 03:53 AM
"button 75: attempt to call nil" is because on line 23 of the button API you've messed up the setTable call - you left out "name" or "label" (not sure which one of them "ButtonText" is) and "active"… Should look like…
setTable("someButton", "ButtonText", funcName, true, 5, 25, 4, 8)

Gonna think about the other error
Larroke #3
Posted 23 April 2013 - 05:51 AM
Thank you for taking a look, I just looked at your suggestion farther but it isn't the cause.

funcName() and fillTable() are actually antiquated functions that aren't used, hadn't removed them for that reason. But I did comment and remove them and received the same grouping of errors, but only the first time I ran them…. Actually you're advice did help me find that error. I was pushing the functions into the table in bcm before the functions were defined, after running the program I guess the functions remained defined in memory (?) which I don't think should happen but it appears to be doing so until I reboot the computer. I defined these functions before the loop that builds the table and that fixes that error.

The bios:336 error still resides and confuses. Confusing, as the only file load routine I appear to be using is the api call which is obviously getting a string.

EDIT: actually, that somehow seems to have been the entire issue. As soon as I fixed that issue it stopped throwing the first error as well. I don't know why, but by the power of duct tape and bubble gum the script works without errors.

Thank you for the help