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

CC Text Byte Assignment

Started by Rectar2, 13 August 2014 - 03:46 AM
Rectar2 #1
Posted 13 August 2014 - 05:46 AM
I've been playing around with string.char in CC a lot recently, and have noticed that every byte above 126 is unassigned, as well as many bytes under 32. As ComputerCraft follows ASCII, the bytes under 32 being unassigned makes sense, as they are the "unprintable" characters. But everything higher than 126 doesn't really make sense.

In my opinion, we should assign these higher values for our own good. Yes, I realize we can't give them actual appearances, but we could give them a meaning to our programs. For example, a byte could be assigned to mean "ping," so in a Rednet command, when this byte is sent, any server it is sent to should reply back with another byte, likely the one directly above it, which could be named "pong."

I'd like to know your guys' opinions on the subject.
Edited on 13 August 2014 - 03:46 AM
flaghacker #2
Posted 13 August 2014 - 07:58 AM
Why would that be better then just sending a string over rednet?
theoriginalbit #3
Posted 13 August 2014 - 08:34 AM
the problem with this is there is a design flaw in LuaJ which means that any string that has chars over 127, will become 127. Basically this means that you can save and read binary files fine, but the minute the string interacts with the event system it will become corrupt. So for example if you send the following string over Rednet "\80\126\130\190" on the other end you'd receive "\80\126\127\127".

EDIT: oh and I'd like to point out that in the past, anyone trying to make community wide standards has failed. its just too difficult.
Edited on 13 August 2014 - 06:34 AM
oeed #4
Posted 13 August 2014 - 08:57 AM
EDIT: oh and I'd like to point out that in the past, anyone trying to make community wide standards has failed. its just too difficult.

While in general that is true it does sometimes work, although more in the case of file formats. Take .nft for example, most people use that rather than making their own format.
Lyqyd #5
Posted 13 August 2014 - 04:04 PM
Also, it makes complete sense when using ASCII that anything greater than 127 may not work as desired, since ASCII is seven bits per character. As mentioned above, you can't do anything useful with those values anyway.