I am playing Feed The Beast and would like to create a network. I can already send binary codes from one computer to another. The method to get a binary code out of a string is the following:
function toBinString(s)
  bytes = {string.byte(s,i,string.len(s))}
  binary = ""
  for i,number in ipairs(bytes) do
    c = 0
    while(number>0) do
      binary = (number%2)..binary
      number = number - (number%2)
      number = number/2
      c = c+1
    end
    while(c<8) do
      binary = "0"..binary
      c = c+1
    end
  end
  return binary
end
function toBin(s)
  binary = toBinString(s)    
  ret = {}
  c = 1
  for i=1,string.len(binary) do
    char = string.sub(binary,i,i)
    if(tonumber(char)==0) then
      ret[c] = 0
      c = c+1
    elseif(tonumber(char)==1) then
      ret[c] = 1
      c = c+1
    elseif(tonumber(char)) then
      print("Error: expected \'0\' or \'1\' but got \'",char,"\'.")
    end
  end
  return ret
end
How can I get the string that was used in string.byte(...)?
