Cannot set property of object of type 'string'

I have a local char variable,

local thisbyte = “”; , which I filled with data from a serial transmission buffer, like this:

thisbyte = byte.tochar(); //Converts integer read by UART into ASCII char for string representation.

I can see that thisbyte indeed contains the char value if I do:

I also have a global string variable which I defined like this

GR <- “”;

Now in my code, I want to fill GR with the value of thisbyte.

I’ve tried several things (below), and each throws an error
(cannot set property of object of type ‘string’),
based upon my poor grammar or syntax.

GR = thisbyte;
GR = byte.tochar();

any help will be appreciated. thisbyte holds a transient value that will change each time I loop over the buffer.
I’m using the global variable GR in if statements after I assign it the value of thisbyte.

Try replacing your third line with

GR = GR + thisbyte

Squirrel conveniently allows you to ‘add up’ strings this way. The .append() method is primarily for array variables, and while strings can be treated as arrays for accessing individual characters, I’m not sure you can append elements to the end. Indeed, your experience suggests not. But concatenating strings with + should work.