Posted 09 February 2013 - 01:55 AM
Hi. Sorry for my english, just in case.
I wrote a script for my bee analyzer to separate pure bee from hybrid ones, print the result on a screen and save the data on a txt file.
this is it: http://pastebin.com/YaFh5vfP
Probably is not the best script (i'm still learning) but it runs fine and does what is supposed to do, but everytime I terminate it and try to type "edit startup" to make some modification i got an error message:
"Edit:118: attemp to call a string". It's not a big deal actually, i can solve the problem rebooting my turtle and editing before running the program, but I was wondering the reason of this behaviour. It seems to give the error only after actually analyzing the bees (from line 70 to line 79). Oh, for everyone who doesn't know how the bee analyzer works, analyze() returns a table with every info about the analyzed bee (the "a" peripheral is the bee analyzer).
I checked the edit program script and line 118 is in this function:
local function tryWrite( sLine, regex, colour )
local match = string.match( sLine, regex )
if match then
if type(colour) == "number" then <————- line 118
term.setTextColour( colour )
else
term.setTextColour( colour(match) )
end
term.write( match )
term.setTextColour( textColour )
return string.sub( sLine, string.len(match) + 1 )
end
return nil
end
Again is not the biggest deal, but can someone help me figure it out?
Am I using some no-no name for my variables or tables?
thanks :P/>/>
I wrote a script for my bee analyzer to separate pure bee from hybrid ones, print the result on a screen and save the data on a txt file.
this is it: http://pastebin.com/YaFh5vfP
Probably is not the best script (i'm still learning) but it runs fine and does what is supposed to do, but everytime I terminate it and try to type "edit startup" to make some modification i got an error message:
"Edit:118: attemp to call a string". It's not a big deal actually, i can solve the problem rebooting my turtle and editing before running the program, but I was wondering the reason of this behaviour. It seems to give the error only after actually analyzing the bees (from line 70 to line 79). Oh, for everyone who doesn't know how the bee analyzer works, analyze() returns a table with every info about the analyzed bee (the "a" peripheral is the bee analyzer).
I checked the edit program script and line 118 is in this function:
local function tryWrite( sLine, regex, colour )
local match = string.match( sLine, regex )
if match then
if type(colour) == "number" then <————- line 118
term.setTextColour( colour )
else
term.setTextColour( colour(match) )
end
term.write( match )
term.setTextColour( textColour )
return string.sub( sLine, string.len(match) + 1 )
end
return nil
end
Again is not the biggest deal, but can someone help me figure it out?
Am I using some no-no name for my variables or tables?
thanks :P/>/>