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

[Question] [Error] Edit bug ?

Started by bjornir90, 19 November 2012 - 07:45 AM
bjornir90 #1
Posted 19 November 2012 - 08:45 AM
Hello everyone !
Sometimes when I want to edit my program, when I use edit … I got a try to call string error (or somethong like that) at line 108 of edit program!
I never touch any of the natives programs and it happen only sometimes…
It is a bug ? It is know ? Did someone else get the same error ?
Orwell #2
Posted 19 November 2012 - 08:49 AM
What version of ComputerCraft do you have? In the edit from CC 1.46 I can't see anything near that line that could cause such an error.
bjornir90 #3
Posted 20 November 2012 - 05:55 AM
What version of ComputerCraft do you have? In the edit from CC 1.46 I can't see anything near that line that could cause such an error.
I'm using 1.46 and an advanced computer… oh sorry it's at line 118 i got an error –'
bjornir90 #4
Posted 29 November 2012 - 04:27 AM
So no one know ? Because it still tell me : edit : 118: attempt to call string when I edit a specific program. :(/>
Dlcruz129 #5
Posted 29 November 2012 - 04:56 AM
You haven't made any changes in your ROM, and you don't have a program named edit amirite?
bjornir90 #6
Posted 29 November 2012 - 05:23 AM
You haven't made any changes in your ROM, and you don't have a program named edit amirite?
No I never touch the ROM and any native program to avoid this kind of error…
Doyle3694 #7
Posted 29 November 2012 - 05:29 AM
have you overwritten edit or any function in it?
bjornir90 #8
Posted 29 November 2012 - 05:31 AM
have you overwritten edit or any function in it?
As said above, I never touch any of the native program/API
Doyle3694 #9
Posted 29 November 2012 - 06:05 AM
well you can still overwrite functions….. Like the famous os.pullEvent = os.pullEventRaw overwrites os.pullEvent
Dlcruz129 #10
Posted 29 November 2012 - 06:08 AM
well you can still overwrite functions….. Like the famous os.pullEvent = os.pullEventRaw overwrites os.pullEvent

Agreed, have you overwritten any functions bjor?
bjornir90 #11
Posted 29 November 2012 - 06:20 AM
The program I try to edit is http://pastebin.com/bEBmy1Zt and I never overwritte any function on this computer because it's my test computer so I let it as I found it XD
Orwell #12
Posted 29 November 2012 - 06:21 AM
Did you experience this on advanced computers? And have you run any programs that declares the variable 'type'?

Edit: Did you run the program above sometimes before editing? It's on line 84.
PixelToast #13
Posted 29 November 2012 - 06:23 AM
The program I try to edit is http://pastebin.com/bEBmy1Zt and I never overwritte any function on this computer because it's my test computer so I let it as I found it XD
line 84:

  type = io.read()
stahp overwriting globals pl0x
Orwell #14
Posted 29 November 2012 - 06:25 AM
Hehe, ninja fight. Bjorn, change line 84 to:

local type = io.read()

This is one of the best examples of why to use 'local' I've ever seen in practice. ^_^/>
bjornir90 #15
Posted 29 November 2012 - 06:26 AM
Oh ok yes that was on an advanced computer and I run it and some other (which are declined from this one) that edit this variable… Thanks you all and sorry for my very noob question …
Orwell #16
Posted 29 November 2012 - 06:28 AM
Oh ok yes that was on an advanced computer and I run it and some other (which are declined from this one) that edit this variable… Thanks you all and sorry for my very noob question …
No problem, we like to help you out. :)/> Do you understand what went wrong?
bjornir90 #17
Posted 29 November 2012 - 06:31 AM
Oh ok yes that was on an advanced computer and I run it and some other (which are declined from this one) that edit this variable… Thanks you all and sorry for my very noob question …
No problem, we like to help you out. :)/>/> Do you understand what went wrong?
Yes, it's because I try to overwrite a variable with read() wich is already defined because it's a global and not a local variable. I didn't believe why I would use local variable instead of global before ^^
Orwell #18
Posted 29 November 2012 - 06:39 AM
:)/> The real big problem here is that type is also a native function. And the edit programs uses that function at, indeed, line 118. Because it's redefined by your program, edit tries to call a string as if it was a function. :P/>
KaoS #19
Posted 29 November 2012 - 06:39 AM
nope. the problem is that the variable is 'type' that is actually a command used in the edit program, you turned it into a string

AAAAAARGH!!! NINJAS :angry:/>
Orwell #20
Posted 29 November 2012 - 06:42 AM
nope. the problem is that the variable is 'type' that is actually a command used in the edit program, you turned it into a string

AAAAAARGH!!! NINJAS :angry:/>
Oh man, you're making me scared. :o/> You are indeed diabolical :P/>
KaoS #21
Posted 29 November 2012 - 06:47 AM
lol I'm going to stop helping people while at work, I always get ninja-ified…
bjornir90 #22
Posted 29 November 2012 - 06:47 AM
Oh ok didn't know that before too ^^ I have a lot of thing to learn ^^ Thanks you alot !
PixelToast #23
Posted 29 November 2012 - 07:48 AM
also
you souldnt overwrite globals at all
localizing can still break functions in child blocks
bjornir90 #24
Posted 29 November 2012 - 07:50 AM
also
you souldnt overwrite globals at all
localizing can still break functions in child blocks
I understand the lesson, now I will use local variables and functions ;)/>