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

error in simple script

Started by MEXAHOTABOP, 27 March 2012 - 09:00 AM
MEXAHOTABOP #1
Posted 27 March 2012 - 11:00 AM
hello
sorry i very bad speak on eng
i write script for long-term storage and encountered with an array of errors
http://pastebin.com/NPWfnhM6
pic - http://itmag.es/2C3F
errors
1) script return his id to sender instead what he sent
2) error on string.sub (line 13) if id invalid

more details can be found in the script
Hawk777 #2
Posted 01 April 2012 - 05:59 AM
First: on line 6 you cannot use the hash operator to get the length of a string, only for getting the length of a table. You want the “string.len” function instead.

Second: on line 13, you are passing a string as the start position parameter to “string.sub”. Remove the quotation marks around the number 1; this function takes a number here, not a string. You are doing the same in some other places too.