Posted 26 June 2016 - 04:58 PM
So I have a program that needs to take a string received through rednet, and determine what the last few letters are.
I have set up a string.sub to handle this that looks like this:
id, message = rednet.receive()
messagesub = string.sub(message, pos1, pos2)
I've tried:
local messagelength = #message - 4 –subtract for from the total length
message = string.sub(message, messagelength)
However, its keeps giving me an error, "attempt to get length of nil"
what I was wondering is if there is a way to get the last 4 letters of the string. Any help is appreciated!
I have set up a string.sub to handle this that looks like this:
id, message = rednet.receive()
messagesub = string.sub(message, pos1, pos2)
I've tried:
local messagelength = #message - 4 –subtract for from the total length
message = string.sub(message, messagelength)
However, its keeps giving me an error, "attempt to get length of nil"
what I was wondering is if there is a way to get the last 4 letters of the string. Any help is appreciated!