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

Problem printing strings

Started by DarkEyeDragon, 28 June 2016 - 12:24 PM
DarkEyeDragon #1
Posted 28 June 2016 - 02:24 PM
Hello! I'm not sure if this should be posted in the bug section, since there's nothing wrong with my code.

I got this weird issue where my computer won't let me print a string. at all.



NOTE: I put everything in comments to make sure that is the issue.
and get this: magreader:2: attempt to call string.
Well obviously its trying to call a string…
and when i tried to put this code on pastebin to show you guys, i got this error:



I made a new program and tried the same. Same error.


this is computercraft 1.74 in the Tekkit Legends modpack.
It worked fine before. Just now started acting up.


Edit: Its only that one computer. I'm very confused on this xD

Edit 2: Anything related to strings in that computer is messed up.


Yet another edit: I was just reading trough the forums and saw this: "string.format is broken in LuaJ, which CC uses. Instead, use string.match, or string.sub." -KingofGamesYami
original post: http://www.computerc...27024-decimals/

And i did try to use the string.format as i couldn't get my other part of code to work since it said it wasn't a string. Might that be the issue here?

Seems like the code i'm using to figure out how to use string.len is causing it to break here.
Edited on 28 June 2016 - 12:43 PM
Lupus590 #2
Posted 28 June 2016 - 02:59 PM
I have a suspicion that something in a startup file has broken something. Try your code on a fresh computer, if that doesn't work then disable your resource pack and see if that works. Otherwise, have you edited your computercraft.jar?

Edit: Good spot Selim (see below)
Edited on 28 June 2016 - 01:38 PM
Selim #3
Posted 28 June 2016 - 03:20 PM
I see the problem already. In the first screenshot, you are setting the value of print to "String length ok!". Due to this, whenever a script attempts to call print, it is calling a string, hence the "attempt to call string" error. Changing the value once changed the global variable and then requires a reboot to fix. If the script was run once, it will not fix until said reboot.
Edited on 28 June 2016 - 01:22 PM
DarkEyeDragon #4
Posted 28 June 2016 - 03:56 PM
I see the problem already. In the first screenshot, you are setting the value of print to "String length ok!". Due to this, whenever a script attempts to call print, it is calling a string, hence the "attempt to call string" error. Changing the value once changed the global variable and then requires a reboot to fix. If the script was run once, it will not fix until said reboot.
omg wow…. i never noticed the = there… xD Thanks for the heads up. The fail is big in this one. very odd non the less xD