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

Edit program not working properly

Started by cgwheeler96, 25 May 2013 - 12:06 PM
cgwheeler96 #1
Posted 25 May 2013 - 02:06 PM
Title: bug [1.53][SSP]Edit program not working properly

I'm not sure if this is relevant, but I have been using the bit API a bit, trying my best at an amature encryption program, and when ever I run the the program and then try to edit it, the edit program crashes giving me this error message:
"edit:388: attempt to index ? (a function value)"
I don't know if this is my code running a weird way or not, but restarting the virtual computer fixes the problem and I am able to edit the code again.
This is the code that seems to be creating the problem:

globalkey = 6

function keys(keyint)

globalkey = globalkey+keyint

return globalkey

end

function encrypt(toEncrypt,enckey)

for i = 1,#toEncrypt do

print(tostring(bit.bxor(toEncrypt,keys(enckey))))

end

end

encrypt({72,101,108,108,111},2)
Lyqyd #2
Posted 25 May 2013 - 03:24 PM
Split into new topic.

You've overridden the keys API, which the edit program uses. Change your keys function to be local or rename it and the problem will go away.
electrodude512 #3
Posted 25 May 2013 - 07:21 PM
Put your code in
 and 
(without the space between
) tags to make it readable.

[code]
if thiscode.isInCodeTags()==true then
	print("This code is readable!")
else
	print("This code is hard to read.  Please put it in [code ] code 
tags.")
end